Grid mapping method and system, electronic equipment and medium
Through the establishment of point-to-point mapping relationship and cloth physical simulation methods, the problems of poor fabric correlation and low mapping relationship accuracy of each layer in grid-based fabric simulation are solved, and the authenticity and visual effect of the simulation are improved.
Patent Information
- Application Number
- CN202411807607.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In grid-based fabric simulation, there is a lack of correlation between the fabrics of each layer, resulting in interspersion problems between layers. At the same time, when establishing a mapping relationship based on the center of gravity coordinates of the triangle based on the point-to-point triangular, it is easy to have low grid accuracy and large movement amplitude, which affects the authenticity and visual effect of the simulation.
Establish mapping relationships through point-to-point methods, obtain character clothing and establish sample grids, create simulation layers and follow-up layers based on sample grids, collect the vertex sets of simulation layers around follow-up points, determine the mapping points and establish a coordinate system, and establish a mapping relationship between follow-up layers and simulation layers based on this, and perform cloth physical simulation.
Improve mapping accuracy, avoid interspersion between layers, enhance the authenticity and visual effects of the simulation, and ensure the consistency of the character's clothing.
Smart Images

Figure CN119919602A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a grid mapping method, system, electronic device and medium. Background Art
[0002] In current game production, more and more games are transferring the animation of character clothing from skin-bone-based simulation to mesh-based cloth simulation. As character clothing becomes more and more complex, the design of clothes with multiple layers of fabric stacked on top of each other is also very common.
[0003] However, in mesh-based cloth simulation, for performance reasons, the most basic unit of simulation is the vertex of the mesh, which has no volume. This results in no correlation between each layer of cloth, and it is easy for layers to intersect during the simulation. In order to solve the above problem, some games currently propose a solution to perform physical simulation on only one layer of the mesh, in order to reduce intersect.
[0004] However, when establishing a mapping relationship based on the barycentric coordinates of points to triangles, it is required that the triangles on the simulation layer should not be deformed too much during the movement. Currently, the establishment of a mapping relationship may result in low mesh accuracy and large movement amplitude. Since the barycentric coordinates cannot be guaranteed to remain unchanged under projection transformation, the triangles in three dimensions will be deformed when projected into two dimensions, causing the coefficients of their barycentric coordinates to change accordingly, causing the triangles to deform, further affecting the authenticity and visual effects of the simulation. Summary of the invention
[0005] The embodiments of the present application provide a grid mapping method, system, electronic device and storage medium, which establish a mapping relationship in a point-to-point manner, can ensure the shape of the character's clothing while improving the mapping accuracy, and improve the simulation authenticity and visual effects.
[0006] In a first aspect, an embodiment of the present application provides a grid mapping method, the method comprising: Obtain character clothing and establish a sample grid corresponding to the character clothing; Creating a simulation layer and a follower layer based on the sample grid, wherein the simulation layer is a layer used to calculate the dynamic behavior of the cloth, and the follower layer is a cloth layer that moves following the simulation layer; For a follower point on the follower layer, a set of simulation layer vertices within a preset range from the follower point is collected; Determine mapping points according to the simulation layer vertex set, and establish a coordinate system according to the mapping points; Based on the coordinate system and the mapping points, a mapping relationship between the follower layer and the simulation layer is established to obtain follower coordinates; Performing cloth physics simulation on the character's clothing according to the follower coordinates to obtain a simulation result.
[0007] In some embodiments, determining a mapping point according to the simulation layer vertex set includes: When the simulation layer vertex set is a non-empty set, calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set to obtain a heuristic set; All heuristic values in the heuristic set are compared to screen out a minimum heuristic value, and the simulation layer vertex corresponding to the minimum heuristic value is used as a mapping point.
[0008] In some embodiments, determining the mapping point according to the simulation layer vertex set further includes: When the simulation layer vertex set is an empty set, the distance values between all vertices on the simulation layer and the follower point are calculated to obtain a distance set; All distance values in the distance set are compared to screen out the minimum distance value, and the vertex corresponding to the minimum distance value is used as a mapping point.
[0009] In some embodiments, calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set to obtain the heuristic set includes: Determine a follower layer normal corresponding to the follower point; For each simulation layer vertex in the simulation layer vertex set, determining a simulation layer normal corresponding to the simulation layer vertex; The proximity between the simulation layer vertex and the following point is measured according to the following layer normal and the simulation layer normal to obtain a heuristic value; The heuristic values of all the simulation layer vertices are sorted to obtain a heuristic set.
[0010] In some embodiments, establishing a coordinate system according to the mapping points includes: Determine tangent information according to the sample grid, and obtain normal information corresponding to the mapping point; Determine bitangent information according to the tangent information and the normal information; A coordinate system is established based on the tangent information, the normal information, and the bitangent information.
[0011] In some embodiments, the step of establishing a mapping relationship between the follower layer and the simulation layer based on the coordinate system and the mapping points to obtain the follower coordinates includes: The following coordinates are calculated according to the tangent information, the normal information, the bitangent information, the coordinates of the mapping point and the preset world coordinates.
[0012] In some embodiments, calculating the distance values between all vertices on the simulation layer and the follower point to obtain a distance set includes: For a vertex on the simulation layer, obtaining a first coordinate of the vertex and a second coordinate of the follower 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 follower point; The distance values of all vertices on the simulation layer are collected to obtain a distance set.
[0013] In a second aspect, an embodiment of the present application further provides a grid mapping system, the system comprising: The calculating the distance values between all vertices on the simulation layer and the follower point to obtain a distance set includes: For a vertex on the simulation layer, obtaining a first coordinate of the vertex and a second coordinate of the follower 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 follower point; The distance values of all vertices on the simulation layer are collected to obtain a distance set.
[0014] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the grid mapping method as described in the first aspect is implemented.
[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the grid mapping method as described in the first aspect.
[0016] The grid mapping method provided in the embodiment of the present application has at least the following beneficial effects: first, the character's clothing is obtained, and a sample grid corresponding to the character's clothing is established, so that the topological structure of the character's clothing can be represented by the sample grid, and then a simulation layer and a follower 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 follow the movement of the simulation layer through the follower layer to maintain the continuity and consistency of the cloth appearance. When establishing a mapping relationship based on the barycentric coordinates of the points to the triangles, it is required that the triangles on the simulation layer cannot be deformed too much during the movement. For any follower point on the follower layer, the embodiment of the present application collects a set of simulation layer vertices within a preset range from the follower point, and then determines the mapping point based on the set of simulation layer vertices, so that the most suitable mapping point on the simulation layer can be found for the follower layer, and a coordinate system is established according to the mapping point. The points of the follower layer are calculated by mapping between points, which can reduce the situation where the calculation error is too large due to the change of the barycentric coordinate basis vector caused by the stretching of the triangles of the mesh, and reduce the calculation error. Afterwards, a mapping relationship between the follower layer and the simulation layer is established based on the coordinate system and the mapping point to obtain the follower coordinates. In addition to ensuring the correct position of the vertices of the follower layer mesh, the shape of the sample mesh can also be guaranteed. Afterwards, the character's clothing is subjected to cloth physics simulation according to the follower coordinates to obtain the simulation result, so that the shape of the character's clothing can be guaranteed while improving the mapping accuracy, avoiding the interlacing between layers, and obtaining the simulation result that conforms to the physical reality.
[0017] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained through the structures particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the examples of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0019] Figure 1 is a flowchart of a specific method of the grid mapping method provided in an embodiment of the present application; Figure 2 It is a specific flow chart of determining a mapping point according to a simulation layer vertex set provided by an embodiment of the present application; Figure 3 is a specific flow chart for determining a mapping point according to a simulation layer vertex set provided by another embodiment of the present application; Figure 4 It is a specific flow chart of calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set provided by the embodiment of the present application; Figure 5 It is a specific flow chart of establishing a coordinate system according to mapping points provided in an embodiment of the present application; Figure 6 It is a specific flow chart of establishing a mapping relationship between a follower layer and a simulation layer based on a coordinate system and mapping points provided in an embodiment of the present application; Figure 7 This is a specific flow chart for calculating the distance values between all vertices and follower points on the simulation layer provided by an embodiment of the present application; Figure 8 is a schematic diagram of the structure of a grid mapping system provided in an embodiment of the present application; Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0021] 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 may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0023] A grid mapping method provided in an embodiment of the present application can be applied to a terminal, can be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, or a smart watch, etc.; the server can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms; the software can be an application that implements the above method, etc., but is not limited to the above forms.
[0024] Embodiments of the present application can be used in numerous 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 computer devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. 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, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0025] In current game production, more and more games are transferring the animation of character clothing from skin-bone-based simulation to mesh-based cloth simulation. As character clothing becomes more and more complex, the design of clothes with multiple layers of fabric stacked together is also very common.
[0026] However, in mesh-based cloth simulation, for performance reasons, the most basic unit of simulation is the vertex of the mesh, which has no volume. This results in no correlation between each layer of cloth, and it is easy for layers to intersect during the simulation. In order to solve the above problem, some games currently propose a solution to perform physical simulation on only one layer of the mesh, in order to reduce intersect.
[0027] However, when establishing a mapping relationship based on the barycentric coordinates of points to triangles, it is required that the triangles on the simulation layer should not be deformed too much during the movement. Currently, the establishment of a mapping relationship may result in low mesh accuracy and large movement amplitude. Since the barycentric coordinates cannot be guaranteed to remain unchanged under projection transformation, the triangles in three dimensions will be deformed when projected into two dimensions, causing the coefficients of their barycentric coordinates to change accordingly, causing the triangles to deform, further affecting the authenticity and visual effects of the simulation.
[0028] In order 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's clothing is obtained, and a sample grid corresponding to the character's clothing is established, so that the topological structure of the character's clothing can be represented by the sample grid, and then a simulation layer and a follower 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 follow the movement of the simulation layer through the follower layer to maintain the continuity and consistency of the cloth appearance. When establishing a mapping relationship based on the barycentric coordinates of the points to the triangles, it is required that the triangles on the simulation layer cannot be deformed too much during the movement. For any follower point on the follower layer, the embodiment of the present application collects a set of simulation layer vertices within a preset range from the follower point, and then determines the mapping point based on the set of simulation layer vertices, so that the most suitable mapping point on the simulation layer can be found for the follower layer, and a coordinate system is established according to the mapping point. The points of the follower layer are calculated by mapping between points, which can reduce the situation where the calculation error is too large due to the change of the barycentric coordinate basis vector caused by the stretching of the triangles of the mesh, and reduce the calculation error. Afterwards, a mapping relationship between the follower layer and the simulation layer is established based on the coordinate system and the mapping point to obtain the follower coordinates. In addition to ensuring the correct position of the vertices of the follower layer mesh, the shape of the sample mesh can also be guaranteed. Afterwards, the character's clothing is subjected to cloth physics simulation according to the follower coordinates to obtain the simulation result, so that the shape of the character's clothing can be guaranteed while improving the mapping accuracy, avoiding the interlacing between layers, and obtaining the simulation result that conforms to the physical reality.
[0029] Reference Figure 1 , Figure 1 1 is a flowchart of a specific method of the grid mapping method provided in an embodiment of the present application. In some embodiments, the grid mapping method includes but is not limited to steps S101 to S106.
[0030] Step S101, obtaining character clothing and establishing a sample grid corresponding to the character clothing.
[0031] In step S101 of some embodiments, in current game production, more and more games transfer the animation of character clothing from the skin-bone-based simulation method to the mesh-based cloth simulation. For the increasingly complex character clothing, the design of clothes with multiple layers of fabric stacked up is also very common. The embodiment of the present application first obtains the character clothing and establishes a sample grid corresponding to the character clothing to facilitate the subsequent establishment of a mapping relationship.
[0032] It is understood that the most basic unit of simulation is the vertex of the mesh.
[0033] In some embodiments, in the process of establishing a sample grid corresponding to the character's clothing, the present application embodiment will create a cloth model corresponding to the character's clothing. This model is used to define the basic shape and structure of the cloth, and then divide the cloth model into a series of grids, where the grid is the basic unit used to represent the topological structure of an object in 3D graphics. 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 assigned physical properties, such as mass, elasticity, friction coefficient, etc. Among them, the properties will affect the behavior of the cloth during the simulation process, thereby realizing the establishment of the sample grid.
[0034] Step S102, creating a simulation layer and a follower layer based on the sample grid, wherein the simulation layer is a layer used to calculate the dynamic behavior of the cloth, and the follower layer is a cloth layer that moves following the simulation layer.
[0035] In step S102 of some embodiments, the motion trajectory of the cloth is predicted using methods such as Newton's laws of motion and numerical integration to obtain a simulation layer. Specifically, during the cloth simulation process, the simulation layer is the cloth level for cloth simulation calculations. The cloth mesh of this level will be updated according to the results of the physical simulation to reflect the dynamic changes of the cloth in the simulation environment. The follower layer is the cloth level that moves with the simulation layer. The cloth mesh of this level will not directly participate in the physical simulation calculation, but will follow the movement of the cloth mesh of the simulation layer through a certain mapping relationship, thereby reducing the amount of calculation while maintaining the continuity and consistency of the cloth appearance.
[0036] Step S103: for the following point on the following layer, collect a set of vertices of the simulation layer within a preset range from the following point.
[0037] In step S103 of some embodiments, for the follower point on the follower layer, a set of simulation layer vertices within a preset range from the follower point is collected, wherein the preset range may be a preset art setting range, to facilitate the subsequent collection of vertices closer to the follower point on the simulation layer.
[0038] It is understandable that the art setting range in the embodiment of the present application can be set according to the needs of the user.
[0039] Step S104, determining mapping points according to the simulation layer vertex set, and establishing a coordinate system according to the mapping points.
[0040] In step S104 of some embodiments, the mapping point is determined based on the simulation layer vertex set. Specifically, the simulation layer vertex closest to the follower point is screened out and determined as the mapping point, thereby avoiding deformation during the mapping process and avoiding the interlacing of layers. A coordinate system is established based on the mapping point, thereby avoiding changes in the barycentric coordinate basis vectors caused by the stretching of the triangle and maintaining the original shape of the mesh.
[0041] Step S105: establishing a mapping relationship between the follow-up layer and the simulation layer based on the coordinate system and the mapping points to obtain the follow-up coordinates.
[0042] In step S105 of some embodiments, a mapping relationship between the follower layer and the simulation layer is established based on the coordinate system and the mapping points, so that the most suitable mapping point on the simulation layer can be found for the follower layer, reducing calculation deviation caused by deformation.
[0043] Step S106, performing cloth physics simulation on the character's clothing according to the follow-up coordinates to obtain a simulation result.
[0044] In step S106 of some embodiments, cloth physics simulation is performed on the character's clothing according to the follower coordinates. Specifically, the simulation layer and the follower layer are associated according to the follower coordinates and the mapping points to ensure that the follower layer can accurately reflect the dynamic changes of the simulation layer. The physical simulation is then run to observe the dynamic performance of the clothing under the influence of the character's actions and obtain simulation results. Through precise mapping and physical simulation, the dynamic performance of the clothing is made more realistic, thereby enhancing the credibility of the character animation.
[0045] Reference Figure 2 , Figure 2 It is a specific flow chart of determining mapping points according to a set of vertices of a simulation layer provided by an embodiment of the present application. In some embodiments, the method includes but is not limited to steps S201 to S202.
[0046] Step S201, when the simulation layer vertex set is a non-empty set, the heuristic value of each simulation layer vertex in the simulation layer vertex set is calculated to obtain a heuristic set.
[0047] Step S202 , compare all heuristic values in the heuristic set to screen out the minimum heuristic value, and use the simulation layer vertex corresponding to the minimum heuristic value as the mapping point.
[0048] In steps S201 to S202 of some embodiments, in the process of determining the mapping point based on the simulation layer vertex set, the embodiments of the present application first determine whether the simulation layer vertex set is an empty set, that is, whether there are simulation layer vertices within a preset range from the follower point. When the simulation layer vertex set is a non-empty set, it means that there are simulation layer vertices within a preset range from 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 during the mapping and calculation process, and a heuristic set is obtained. All heuristic values in the heuristic set are compared to filter out the minimum heuristic value, thereby filtering out the simulation layer vertex closest to the follower point, and using the simulation layer vertex corresponding to the minimum heuristic value as the mapping point, thereby avoiding deformation during the mapping process and avoiding the interlacing of layers.
[0049] Reference Figure 3 , Figure 3 It is a specific flow chart of determining mapping points according to a simulation layer vertex set provided by another embodiment of the present application. In some embodiments, the method includes but is not limited to steps S301 to S302.
[0050] Step S301, when the vertex set of the simulation layer is an empty set, the distance values between all vertices on the simulation layer and the follower point are calculated to obtain a distance set.
[0051] Step S302: compare all distance values in the distance set to filter out the minimum distance value, and use the vertex corresponding to the minimum distance value as a mapping point.
[0052] In some embodiments, in steps S301 to S302, in the process of determining the mapping point based on the simulation layer vertex set, when the simulation layer vertex set is an empty set, it means 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 from the follower point, and the vertex on the simulation layer is far away from the follower point. It is necessary to calculate the distance values of all vertices on the simulation layer and the follower point to obtain the distance set, and then compare all the distance values in the distance set to filter out the minimum distance value, and use the vertex corresponding to the minimum distance value as the mapping point, so as to find the point closest to the point in the simulation layer, and use the point with the closest distance as the mapping point to avoid the situation where layers are interlaced.
[0053] Reference Figure 4 , Figure 4 It is a specific flow chart of calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set provided by the embodiment of the present application. The method includes but is not limited to steps S401 to S404.
[0054] Step S401, determining the follower layer normal corresponding to the follower point.
[0055] Step S402: for each simulation layer vertex in the simulation layer vertex set, determine the simulation layer normal corresponding to the simulation layer vertex.
[0056] Step S403, measuring the proximity between the simulation layer vertex and the following point according to the following layer normal and the simulation layer normal to obtain a heuristic value.
[0057] Step S404, sorting the heuristic values of all simulation layer vertices to obtain a heuristic set.
[0058] 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, and 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 lines, when the orientations of the points are close enough, it can be considered that the orientations of the faces they constitute are also relatively close. Based on the above principles, the embodiments of the present application measure the proximity 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. Finally, the heuristic values of all simulation layer vertices are sorted to obtain a heuristic set, so as to maintain the consistency of the modeling during the mapping and calculation process.
[0059] It can be understood that in the embodiment of the present application, in the process of measuring the proximity between the simulation layer vertex and the following point according to the following layer normal and the simulation layer normal, the smaller the heuristic value, the closer the direction is, and the larger the heuristic value, the farther the direction is.
[0060] Specifically, the specific process of measuring the proximity between the simulation layer vertex and the following point according to the following layer normal and the simulation layer normal is as follows: F(normal1,normal2)=1-normal1*normal2; Among them, 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.
[0061] Reference Figure 5 , Figure 5 It is a specific flow chart of establishing a coordinate system according to mapping points provided by an embodiment of the present application. In some embodiments, the method includes but is not limited to steps S501 to S503.
[0062] Step S501, determining tangent information according to the sample grid, and obtaining normal information corresponding to the mapping point.
[0063] Step S502, determining secondary tangent information according to tangent information and normal information.
[0064] Step S503: establishing a coordinate system based on the tangent information, the normal information and the bitangent information.
[0065] In steps S501 to S503 of some embodiments, in the process of establishing a coordinate system according to the mapping points, since the normal of the coordinate system will change in the simulation calculation of the cloth, the embodiment of the present application first determines the tangent information according to the sample grid, and obtains the normal information corresponding to the mapping point, and then determines the secondary tangent information according to the tangent information and the normal information. Specifically, the secondary tangent is the outer product of the normal and the tangent. After that, the coordinate system is established based on the tangent information, the normal information and the secondary tangent information, so as to avoid the change of the centroid coordinate basis vector caused by the stretching of the triangle and maintain the original shape of the grid.
[0066] Specifically, the process of determining the bitangent information based on the tangent information and the normal information is as follows: B=(Ny*Tz-Nz*Ty,Nz*Tx-Nx*Tz,Nx*Ty-Ny*Tx); Among them, B is the bitangent, 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.
[0067] Reference Figure 6 , Figure 6 It is a specific flow chart of establishing a mapping relationship between a follower layer and a simulation layer based on a coordinate system and mapping points provided in an embodiment of the present application. In some embodiments, the method includes but is not limited to step S601.
[0068] Step S601, calculating the follow-up coordinates according to the tangent information, the normal information, the bitangent information, the coordinates of the mapping point and the preset world coordinates.
[0069] In step S601 of some embodiments, in the process of establishing a mapping relationship between the following layer and the simulation layer based on the coordinate system and the mapping point, the following coordinates are calculated according to the coordinate system and the coordinate values calculated by the mapping. Specifically, the following coordinates are calculated according to the tangent information, normal information, secondary tangent information, the coordinates of the mapping point and the preset world coordinates, so as to find the most suitable mapping point on the simulation layer for the following layer, thereby reducing the calculation deviation caused by deformation.
[0070] It can be understood that the world coordinates in the embodiment of the present application are the world coordinates of the mapping point of the simulation layer. Specifically, the world coordinates are the position of a point in the simulation layer in the world coordinate system, where the world coordinate system is a global reference frame used to define the position, direction and scale of all objects in the scene.
[0071] Specifically, the process of calculating the moving coordinates is as follows: F(a,b,c)=p+a*T+b*B+c*N; Among them, p is the world coordinate of the mapping point of the simulation layer, a, b and c are the coordinate values of the mapping point, B is the secondary tangent, N is the normal, and T is the tangent.
[0072] Reference Figure 7 , Figure 7 The specific flow chart of calculating the distance values between all vertices and the follower point on the simulation layer provided by the embodiment of the present application is as follows. In some embodiments, the method includes but is not limited to steps S701 to S703.
[0073] Step S701, for a vertex on the simulation layer, obtain the first coordinate of the vertex and the second coordinate of the follower point.
[0074] Step S702: 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 follower point.
[0075] Step S703, collecting the distance values of all vertices on the simulation layer to obtain a distance set.
[0076] In steps S701 to S703 of some embodiments, in the process of calculating the distance values between all vertices and the follower point on the simulation layer, for the vertices on the simulation layer, the first coordinates of the vertex on the simulation layer and the second coordinates of the follower point are obtained, wherein the first coordinate and the second coordinate both include horizontal axis coordinates, vertical axis coordinates and depth axis coordinates. Thereafter, the distance calculation is performed on the first coordinate and the second coordinate based on a preset Euclidean algorithm. Specifically, the square of the difference between the two points on each coordinate axis is calculated, and then these square values are added, and the square root of the sum is taken to obtain the distance value between the vertex and the follower point, thereby realizing the calculation of the distance value between the vertex and the follower point, and then the distance values of all vertices on the simulation layer are collected to obtain a distance set, thereby determining the distance between each vertex on the simulation layer and the follower point, so as to facilitate the subsequent selection of a suitable mapping point.
[0077] See also Figure 8 The present application also provides a grid mapping system that can implement the above-mentioned grid mapping method. The system includes: The clothing acquisition module 801 is used to acquire character clothing and establish a sample grid corresponding to the character clothing; A layer creation module 802 is used to create a simulation layer and a follower layer based on the sample grid, wherein the simulation layer is a layer used to calculate the dynamic behavior of the cloth, and the follower layer is a cloth layer that moves with the simulation layer; The vertex collection module 803 is used to collect a set of simulation layer vertices within a preset range from a follower point on the follower layer; A coordinate establishment module 804, used to determine a mapping point according to a set of vertices of a simulation layer, and to establish a coordinate system according to the mapping point; A mapping establishment module 805 is used to establish a mapping relationship between the follower layer and the simulation layer based on the coordinate system and the mapping points to obtain the follower coordinates; The physical simulation module 806 is used to perform cloth physical simulation on the character's clothing according to the follow-up coordinates to obtain simulation results.
[0078] The grid mapping system of the embodiment of the present application is used to execute the grid mapping method in the above embodiment. Its specific processing process is the same as the grid mapping method in the above embodiment, and will not be repeated here.
[0079] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is used to execute the grid mapping method in the above embodiment of the present application.
[0080] See also Fig. 9 , Fig. 9 The hardware structure of the electronic device provided in the embodiment of the present application is illustrated, and the electronic device includes: The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application; The memory 902 may 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). The memory 902 may store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the grid mapping method of the embodiment of this application; Input / output interface 903, used to implement information input and output; Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.); A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904); The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0081] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned grid mapping method is implemented.
[0082] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via 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 combinations thereof.
[0083] The embodiments described in the embodiments of the present application are intended 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 in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0084] It can be understood by those skilled in the art that Figure 1-9 The technical solutions shown in the figure do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.
[0085] The system embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0086] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0087] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0088] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: 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 indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0089] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0090] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0091] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0092] If the integrated unit is implemented 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 solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0093] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the rights of the present application is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application should be within the scope of the rights of the present application.
Claims
1. A grid mapping method, characterized in that: The method comprises: Obtain character clothing and establish a sample grid corresponding to the character clothing; Creating a simulation layer and a follower layer based on the sample grid, wherein the simulation layer is a layer used to calculate the dynamic behavior of the cloth, and the follower layer is a cloth layer that moves following the simulation layer; For a follower point on the follower layer, a set of simulation layer vertices within a preset range from the follower point is collected; Determine mapping points according to the simulation layer vertex set, and establish a coordinate system according to the mapping points; Based on the coordinate system and the mapping points, a mapping relationship between the follower layer and the simulation layer is established to obtain follower coordinates; Performing cloth physics simulation on the character's clothing according to the follower coordinates to obtain a simulation result.
2. The grid mapping method according to claim 1, characterized in that: The determining of the mapping point according to the simulation layer vertex set comprises: When the simulation layer vertex set is a non-empty set, calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set to obtain a heuristic set; All heuristic values in the heuristic set are compared to screen out a minimum heuristic value, and the simulation layer vertex corresponding to the minimum heuristic value is used as a mapping point.
3. The grid mapping method according to claim 1, characterized in that: The determining of the mapping point according to the simulation layer vertex set also includes: When the simulation layer vertex set is an empty set, the distance values between all vertices on the simulation layer and the follower point are calculated to obtain a distance set; All distance values in the distance set are compared to screen out the minimum distance value, and the vertex corresponding to the minimum distance value is used as a mapping point.
4. The grid mapping method according to claim 2, characterized in that: The calculating the heuristic value of each simulation layer vertex in the simulation layer vertex set to obtain the heuristic set includes: Determine a follower layer normal corresponding to the follower point; For each simulation layer vertex in the simulation layer vertex set, determining a simulation layer normal corresponding to the simulation layer vertex; The proximity between the simulation layer vertex and the following point is measured according to the following layer normal and the simulation layer normal to obtain a heuristic value; The heuristic values of all the simulation layer vertices are sorted to obtain a heuristic set.
5. The grid mapping method according to claim 1, characterized in that: The establishing of a coordinate system according to the mapping points comprises: Determine tangent information according to the sample grid, and obtain normal information corresponding to the mapping point; Determine bitangent information according to the tangent information and the normal information; A coordinate system is established based on the tangent information, the normal information, and the bitangent information.
6. The grid mapping method according to claim 5, characterized in that: The step of establishing a mapping relationship between the follower layer and the simulation layer based on the coordinate system and the mapping points to obtain the follower coordinates includes: The following coordinates are calculated according to the tangent information, the normal information, the bitangent information, the coordinates of the mapping point and the preset world coordinates.
7. The grid mapping method according to claim 3, characterized in that: The calculating the distance values between all vertices on the simulation layer and the follower point to obtain a distance set includes: For a vertex on the simulation layer, obtaining a first coordinate of the vertex and a second coordinate of the follower 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 follower point; The distance values of all vertices on the simulation layer are collected to obtain a distance set.
8. A grid mapping system, characterized in that: The system comprises: A clothing acquisition module, used to acquire character clothing and establish a sample grid corresponding to the character clothing; A layer creation module, used to create a simulation layer and a follower layer based on the sample grid, wherein the simulation layer is a layer used to calculate the dynamic behavior of the cloth, and the follower layer is a cloth layer that moves following the simulation layer; A vertex collection module, for collecting, for a follower point on the follower layer, a set of simulation layer vertices within a preset range from the follower point; A coordinate establishment module, used for determining a mapping point according to the simulation layer vertex set, and establishing a coordinate system according to the mapping point; A mapping establishment module, used to establish a mapping relationship between the follower layer and the simulation layer based on the coordinate system and the mapping points to obtain the follower coordinates; The physical simulation module is used to perform cloth physical simulation on the character's clothing according to the follower coordinates to obtain a simulation result.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the grid mapping method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the grid mapping method according to any one of claims 1 to 7.
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
Multi-layer cloth animation resolving method and device and electronic equipment
CN117274444A
Generation method and device of cloth simulation effect, storage medium and electronic device
CN117861204A