Soft-body object rendering method and apparatus, and computer device and storage medium
By obtaining and mapping low-precision physical mesh model and high-precision rendering mesh model of soft body objects, establishing relative position information, solving the problem of rendering distortion of complex soft body objects in traditional rendering technology, achieving more efficient and realistic rendering Effect.
Patent Information
- Application Number
- PCT/CN2024/092643
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-04
- Filing Date
- 2024-05-11
- Publication Date
- 2025-01-09
AI Technical Summary
Traditional technology has the problem of rendering distortion when rendering complex soft-body objects, especially multi-layer clothing objects, which are difficult to maintain high precision and authenticity in real-time rendering.
By obtaining the low-precision physical mesh model and high-precision rendering mesh model of soft body objects, we establish the relative position information between the mesh vertices and the patch, generate model mapping information, and transform the rendering mesh model based on this information , to improve rendering effect.
Improves the rendering effect of soft-body objects, reduces rendering distortion, enhances the flexibility and diversity of rendering, and is suitable for high-precision fabric simulation scenarios.
Smart Images

Figure CN2024092643_09012025_PF_FP_ABST
Abstract
Description
Soft body object rendering method, device, computer equipment and storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2023108101601, filed on July 4, 2023, entitled “Soft body object rendering method, device, computer device and storage medium,” the entire text of which is hereby incorporated by reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for rendering a soft body object. Background Art
[0004] With the advancement of computer technology, virtual scenes are becoming increasingly popular. These scenes often contain soft-body objects, such as clothing worn by characters, curtains, or handkerchiefs. Because soft-body objects change state under the influence of external forces, the effects of these forces on soft-body objects must be considered during real-time rendering of virtual scenes to ensure a more realistic rendering.
[0005] In conventional technology, a first physical mesh model and a first rendering mesh model are generated for a flexible body object, and a mapping relationship is established between the first physical mesh model and the first rendering mesh model. When an external force is applied to the flexible body object, the shape of the first physical mesh model is adjusted according to the external force, and the shape of the rendering mesh model is adjusted based on the mapping relationship between the first physical mesh model and the first rendering mesh model. The first rendering mesh model is then rendered to obtain the flexible body object after the external force is applied.
[0006] However, for complex soft-body objects such as multi-layered clothing, traditional technologies have poor rendering effects and suffer from rendering distortion.
[0007] Summary of the Invention
[0008] According to various embodiments of the present application, a method, apparatus, computer device, computer-readable storage medium, and computer program product for rendering a soft body object are provided.
[0009] In one aspect, the present application provides a method for rendering a soft body object, which is executed by a computer device, and the method includes:
[0010] Obtaining a first physical mesh model and a first rendering mesh model of the flexible body object in a preset first form, where the accuracy of the first physical mesh model is lower than the accuracy of the first rendering mesh model;
[0011] Taking a rendering vertex in a first type of mesh area in the first rendering mesh model as a first rendering vertex, determining a mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, and determining relative position information between the first rendering vertex and the mapping patch;
[0012] using a rendering vertex in a second type of mesh area in the first rendering mesh model as a second rendering vertex, determining a mapped physical vertex corresponding to the second rendering vertex from each physical vertex of the first physical mesh model, and determining relative position information between the second rendering vertex and the corresponding mapped physical vertex, wherein the complexity of the second type of mesh area is greater than the complexity of the first type of mesh area;
[0013] generating model mapping information corresponding to the soft body object based on each relative position information;
[0014] When rendering the soft body object, the first rendering mesh model is transformed according to the model mapping information and the transformation of the first physical mesh model, and the soft body object is rendered using the transformed first rendering mesh model.
[0015] On the other hand, the present application also provides a soft body object rendering device, the device comprising:
[0016] A mesh model acquisition module, configured to acquire a first physical mesh model and a first rendering mesh model of the flexible body object in a preset first form, wherein the accuracy of the first physical mesh model is lower than the accuracy of the first rendering mesh model;
[0017] a first information determination module, configured to use a rendering vertex in a first type of mesh area in the first rendering mesh model as a first rendering vertex, determine a mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, and determine relative position information between the first rendering vertex and the mapping patch;
[0018] a second information determination module, configured to use a rendering vertex in a second type of mesh area in the first rendering mesh model as a second rendering vertex, determine a mapped physical vertex corresponding to the second rendering vertex from each physical vertex of the first physical mesh model, and determine relative position information between the second rendering vertex and the corresponding mapped physical vertex, wherein the complexity of the second type of mesh area is greater than the complexity of the first type of mesh area;
[0019] a mapping information determining module, configured to generate model mapping information corresponding to the soft body object based on each of the relative position information; and
[0020] A rendering module is used to transform the first rendering mesh model according to the model mapping information and the transformation of the first physical mesh model when rendering the soft body object, and render the soft body object using the transformed first rendering mesh model.
[0021] On the other hand, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned soft body object rendering method when executing the computer program.
[0022] In another aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-mentioned soft body object rendering method.
[0023] On the other hand, the present application further provides a computer program product, which includes a computer program that implements the steps in the above-mentioned soft body object rendering method when executed by a processor.
[0024] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0026] FIG1 is a diagram illustrating an application environment of a soft body object rendering method in some embodiments;
[0027] FIG2 is a schematic flow chart of a method for rendering a soft body object in some embodiments;
[0028] FIG3 is a schematic diagram of a rendering mesh model obtained after being affected by external forces in some embodiments;
[0029] FIG4 is a schematic diagram of a rendered mesh model after being affected by external forces in some embodiments;
[0030] FIG5 is a schematic flow chart of a method for rendering a soft body object in some embodiments;
[0031] FIG6 is a schematic diagram of setting weights for a physical grid model in some embodiments;
[0032] FIG7 is a schematic diagram of setting weights for rendering a mesh model in some embodiments;
[0033] FIG8 is a schematic diagram of obtaining model mapping information in some embodiments;
[0034] FIG9 is a schematic flow chart of a method for rendering a soft body object in some embodiments;
[0035] FIG10 is a block diagram of a soft body object rendering apparatus in some embodiments;
[0036] FIG11 is a diagram illustrating the internal structure of a computer device in some embodiments;
[0037] FIG12 is a diagram illustrating the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0039] The soft body object rendering method provided in the embodiments of the present application can be applied in the application environment shown in FIG1 . In this embodiment, a terminal 102 communicates with a server 104 via a network. A data storage system can store data that the server 104 needs to process. The data storage system can be integrated with the server 104 or placed in the cloud or on another server.
[0040] Specifically, terminal 102 obtains a first physical mesh model and a first rendering mesh model of a flexible body object in a preset first form. The precision of the first physical mesh model is lower than that of the first rendering mesh model. Terminal 102 uses a rendering vertex in a first type of mesh region in the first rendering mesh model as a first rendering vertex, determines a mapping patch corresponding to the first rendering vertex from each patch in the first physical mesh model, and determines relative position information between the first rendering vertex and the mapping patch. Terminal 102 uses a rendering vertex in a second type of mesh region in the first rendering mesh model as a second rendering vertex, determines a mapping physical vertex corresponding to the second rendering vertex from each physical vertex in the first physical mesh model, and determines relative position information between the second rendering vertex and the corresponding mapping physical vertex. The complexity of the second type of mesh region is higher than that of the first type of mesh region. Terminal 102 generates model mapping information corresponding to the flexible body object based on the relative position information. Terminal 102 may transmit the model mapping information corresponding to the flexible body object to server 104. Server 104 may store the model mapping information corresponding to the flexible body object. When another device renders an image including the flexible body, server 104 may send model mapping information corresponding to the flexible body object to the other device, so that when the other device renders the flexible body object, it transforms the first rendering mesh model according to the model mapping information and the transformation of the first physical mesh model, and uses the transformed first rendering mesh model to render the flexible body object.
[0041] Terminal 102 may include, but is not limited to, various desktop computers, laptops, smartphones, tablet computers, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices may include smart watches, smart bracelets, and head-mounted devices. Server 104 may be implemented as a standalone server or a server cluster consisting of multiple servers.
[0042] In some embodiments, as shown in FIG2 , a method for rendering a soft body object is provided. The method can be executed by a terminal or a server, or can be executed by both the terminal and the server. The method is described by taking the terminal in FIG1 as an example, and includes the following steps:
[0043] Step 202 : obtaining a first physical mesh model and a first rendering mesh model of the flexible body object in a preset first form, wherein the accuracy of the first physical mesh model is lower than the accuracy of the first rendering mesh model.
[0044] A soft body object refers to a flexible object. A soft body object may have the following characteristics: when a non-destructive external force is applied to the soft body object, the soft body object deforms, and when the external force is removed, the soft body object does not return to its original shape. A soft body object is an object in a virtual scene. A soft body object may be made of a flexible material, including but not limited to cloth or rubber. A soft body object may be at least one of the following: clothing for a character in the virtual scene, curtains or handkerchiefs in the virtual scene, or a ball in the virtual scene. Clothing for a character in the virtual scene may be single-layer clothing or multi-layer clothing. Multi-layer clothing refers to clothing consisting of at least two layers of fabric.
[0045] A virtual scene is a virtual scene displayed (or provided) when an application is running on a terminal. The virtual scene can be a simulation of the real world, a semi-real and semi-fictitious three-dimensional environment, or a purely fictitious three-dimensional environment. The virtual scene can be any of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. The target observation angle can be any observation angle. Virtual scenes include, but are not limited to, scenes such as film and television special effects, games, mirror simulation, visual design, VR (Virtual Reality), and digital cultural creation.
[0046] Both the physical mesh model and the rendering mesh model are three-dimensional mesh models. A three-dimensional mesh model consists of vertices, edges, and patches. A three-dimensional mesh model can include multiple vertices. An edge is a line connecting two vertices, and a patch is a triangle formed by connecting three vertices. The smallest geometric figure in a three-dimensional mesh model is a triangle, which consists of three vertices and three edges. The first physical mesh model and the first rendering mesh model are both used to represent flexible objects. The difference lies in their precision. The precision of the first physical mesh model is lower than that of the first rendering mesh model. Therefore, the physical mesh model can be referred to as a low model, and the first rendering mesh model can be referred to as a high model. Precision can be determined by the number of vertices; more vertices indicate greater precision. The first physical mesh model has fewer vertices than the first rendering mesh model. For example, the first physical mesh model has 10,660 vertices, while the first rendering mesh model has 12,748 vertices. Precision can also be determined by the number of patches; more patches indicate greater precision. The first physical mesh model has fewer patches than the first rendering mesh model.
[0047] When a soft body object consists of multiple connected or independent components, both the first physical mesh and the first rendering mesh can have a multi-layered structure, defined as a structure formed by at least two deformable surfaces connected together in any relative orientation. This structure can be used to model complex objects such as clothing accessories and multi-layered garments. By connecting different surfaces together, you can create a surface with multiple layers, each with its own unique geometry and motion.
[0048] A deformable surface is one that can simulate the movement and deformation of objects by changing its geometry. Deformable surfaces are typically composed of multiple triangles, which can be increased or decreased as needed. In computer graphics, deformable surfaces are widely used to model complex objects such as clothing, skin, and liquids. By precisely controlling deformable surfaces, physical simulations can be achieved, providing powerful tools for fields such as virtual reality and game development.
[0049] The shape of a soft body object can change. For example, the shape of a multi-layered costume with a soft body object as the character can change. The preset shape can be any shape of the soft body object. The vertices in the physical mesh model of the soft body object can be moved. Therefore, by changing the position of the vertices in the physical mesh model of the soft body object, the physical mesh model can represent a soft body object of any shape. Similarly, the vertices in the rendering mesh model of the soft body object can also be moved. By changing the position of the vertices in the rendering mesh model of the soft body object, the rendering mesh model can represent a soft body object of different shapes.
[0050] The first physical mesh model of a flexible body object in a preset first form is used to represent the flexible body object in the preset first form, that is, to represent the flexible body object with the preset first form. The first rendering mesh model of a flexible body object in the preset first form is used to represent the flexible body object in the preset first form, that is, to represent the flexible body object with the preset first form. To facilitate distinguishing the physical mesh models of a flexible body object in different forms, the physical mesh model of the flexible body object in the preset first form is referred to as the first physical mesh model, and the rendering mesh model of the flexible body object in the preset first form is referred to as the first rendering mesh model. It should be noted that the model structure of the physical mesh models of the flexible body object in different forms is the same, that is, the vertices, edges, and patches included are the same. The only difference is the position of the vertices. A change in the position of the vertices will cause the position of the edges and patches to change. Similarly, the model structure of the rendering mesh models of the flexible body object in different forms remains unchanged. Only the position of the vertices, edges, and patches changes.
[0051] Specifically, the first physical mesh model of the flexible body object in the preset first form is pre-generated. The first rendering mesh model of the flexible body object in the preset first form is pre-generated, for example, by a tool for generating a three-dimensional mesh model.
[0052] In some embodiments, the first physical mesh model and the first rendering mesh model can be stored in the same FBX file. FBX (Filmbox) is a 3D file format primarily used for model and scene interaction between different 3D software. FBX files can be used in fields such as game development, virtual reality, filmmaking, and industrial design. That is, the first physical mesh model and the first rendering mesh model can be stored in the same FBX file. Of course, the first physical mesh model and the first rendering mesh model can also be stored in different FBX files.
[0053] Step 204 : Using a rendering vertex in a first type of mesh area in the first rendering mesh model as a first rendering vertex, determining a mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, and determining relative position information between the first rendering vertex and the mapping patch.
[0054] Vertices in a rendering mesh model can be referred to as rendering vertices, while vertices in a physical mesh model can be referred to as physical vertices. A mesh region is a portion of a three-dimensional mesh model, which can be either a physical mesh model or a rendering mesh model. Mesh regions in a first rendering mesh model can be divided into first-type mesh regions and second-type mesh regions, with the complexity of second-type mesh regions being higher than that of first-type mesh regions. Complexity can be determined based on vertex density; for example, a higher vertex density indicates a higher complexity. A first rendering mesh model can contain at least one second-type mesh region, and a first rendering mesh model can contain at least one first-type mesh region. The complexity of each second-type mesh region is higher than the complexity of each first-type mesh region. Complexity can also be determined by the presence or absence of wrinkles or concavities. Smooth, wrinkle-free mesh regions have lower complexity than those with wrinkles or concavities. For example, if a soft body object is a multi-layered garment, and the first rendering mesh model represents the multi-layered garment, mesh regions such as ribbons, decorations, and hems with low flatness precision on the garment would be considered first-type mesh regions.
[0055] The mesh area includes a plurality of vertices, where a plurality refers to at least two. The first rendering vertex refers to a rendering vertex in a mesh area of the first type in the first rendering mesh model.
[0056] Specifically, the terminal may generate a corresponding bounding box for a patch in the first physical mesh model; the bounding box corresponding to the patch refers to a geometric body that encloses the patch. The terminal may determine the bounding box where the first rendering vertex is located from the generated bounding boxes, and obtain the adjacent bounding box corresponding to the first rendering vertex. The terminal may determine the patch corresponding to the adjacent bounding box as the adjacent patch of the first rendering vertex, and determine the mapping patch corresponding to the first rendering vertex from the adjacent patches of the first rendering vertex.
[0057] In some embodiments, the terminal may determine any neighboring patch of the first rendering vertex as the mapping patch corresponding to the first rendering vertex. Alternatively, the terminal may project the first rendering vertex onto the plane where the neighboring patch lies, and if the projection point of the first rendering vertex on the plane where the neighboring patch lies lies within the neighboring patch, then the neighboring patch is determined as the mapping patch corresponding to the first rendering vertex.
[0058] In some embodiments, the terminal may project the first rendering vertex onto the mapping patch and determine the projection point of the first rendering vertex on the mapping patch. The terminal may determine first relative position information between the projection point and the mapping patch, and determine second relative position information between the projection point and the first rendering vertex. The position of the projection point is related to the position of the mapping patch through the first relative position information, and the position of the first rendering vertex is related to the position of the projection point through the second relative position information. The terminal may obtain the relative position information between the first rendering vertex and the mapping patch based on the first relative position information and the second relative position information.
[0059] In step 206, a rendering vertex in a second type of mesh area in the first rendering mesh model is used as a second rendering vertex, a mapped physical vertex corresponding to the second rendering vertex is determined from the physical vertices of the first physical mesh model, and relative position information between the second rendering vertex and the corresponding mapped physical vertex is determined. The complexity of the second type of mesh area is higher than the complexity of the first type of mesh area.
[0060] The second rendering vertex is a rendering vertex in a second type of mesh region in the first rendering mesh model; the second type of mesh region has a higher complexity than the first type of mesh region. The mapped physical vertex corresponding to the second rendering vertex may be referred to as a mapping point corresponding to the second rendering vertex.
[0061] Specifically, the terminal can generate a corresponding bounding box for each facet in the first physical mesh model, determine the bounding box where the second rendering vertex is located from the bounding box of each facet, obtain the target bounding box, and determine the facet corresponding to the target bounding box as the target facet corresponding to the second rendering vertex. There can be one or more target faces, and multiple means at least two. The terminal can determine the distance between each physical vertex of each target facet and the second rendering vertex; based on the distance between each physical vertex of each target facet and the second rendering vertex, determine the mapped physical vertex corresponding to the second rendering vertex from each physical vertex of each target facet.
[0062] In some embodiments, for each physical vertex in each target patch, the terminal calculates the distance between the physical vertex and the second rendering vertex, and determines the physical vertex with the smallest distance as the mapped physical vertex corresponding to the second rendering vertex.
[0063] In some embodiments, the relative position information between the second rendering vertex and the corresponding mapped physical vertex is used to establish a relationship between the coordinates of the mapped physical vertex and the coordinates of the second rendering vertex. For example, the relative position information may be an affine transformation matrix, which is used to establish a relationship between the coordinates of the mapped physical vertex and the coordinates of the second rendering vertex. The result of transforming the physical mapped vertex using the affine transformation matrix is the coordinates of the second rendering vertex. For example, if the affine transformation matrix is M, the coordinates of the mapped physical vertex are P1, and the coordinates of the second rendering vertex are P2, then P2 = P1 × M.
[0064] Step 208: Generate model mapping information corresponding to the soft body object based on the relative position information.
[0065] Specifically, the terminal combines the relative position information between the first rendering vertex and the corresponding mapping surface, and the relative position information between the second rendering vertex and the mapped physical vertex, into model mapping information corresponding to the soft body object.
[0066] Step 210 : When rendering the soft body object, transform the first rendering mesh model according to the model mapping information and the transformation of the first physical mesh model, and render the soft body object using the transformed first rendering mesh model.
[0067] In some embodiments, steps 202-208 are performed offline, that is, before real-time rendering. This means that the model mapping information is pre-generated, not generated during real-time rendering. During real-time rendering, step 210 is executed to perform real-time rendering based on the pre-generated model mapping information, resulting in a rendering result for the flexible body object.
[0068] In some embodiments, during real-time rendering of the flexible body object, the terminal obtains a second physical mesh model and a second rendering mesh model of the flexible body object in its current state. The terminal moves physical vertices in the second physical mesh model affected by an external force to obtain a first physical mesh model affected by the external force. For a first rendering vertex in the second rendering mesh model affected by the external force, the terminal determines relative position information between the first rendering vertex and a corresponding mapping facet from model mapping information. Based on the relative position information between the first rendering vertex and the corresponding mapping facet, the terminal moves the first rendering vertex affected by the external force. For a second rendering vertex in the second rendering mesh model affected by the external force, the terminal determines relative position information between the second rendering vertex and a corresponding mapping physical vertex from the model mapping information. Based on the relative position information between the second rendering vertex and the corresponding mapping physical vertex, the terminal moves the second rendering vertex affected by the external force to obtain the first rendering mesh model affected by the external force. The terminal then renders the first rendering mesh model affected by the external force to obtain a rendering result of the flexible body object. The external force refers to a force applied to the flexible body object by something outside the flexible body object. For example, in a virtual scene, the external force can be something that comes into contact with a soft body object in the virtual scene. For example, the soft body object is a multi-layered garment. When a character wearing the multi-layered garment moves, the character will exert force on the multi-layered garment, causing the multi-layered garment to deform. Of course, it can also be the wind in the virtual scene.
[0069] In the above-mentioned soft body object rendering method, a first physical mesh model and a first rendering mesh model of the soft body object in a preset first form are obtained, the accuracy of the first physical mesh model is lower than the accuracy of the first rendering mesh model, a mapping facet corresponding to a first rendering vertex is determined from each facet of the first physical mesh model, and relative position information between the first rendering vertex and the mapping facet is determined, the first rendering vertex is a rendering vertex in a first type of mesh area in the first rendering mesh model, a mapping physical vertex corresponding to a second rendering vertex is determined from each physical vertex of the first physical mesh model, and relative position information between the second rendering vertex and the corresponding mapping physical vertex is determined, the second rendering vertex is a rendering vertex in a second type of mesh area in the first rendering mesh model, the complexity of the second type of mesh area is higher than the complexity of the first type of mesh area, model mapping information corresponding to the soft body object is generated based on the relative position information, the model mapping information is used to transform the first rendering mesh model based on the transformation of the first physical mesh model during rendering, and the transformed first rendering mesh model is used for rendering the soft body object. Therefore, the relationship between vertices is established in the mesh area with higher complexity, and the relationship between vertices and patches is established in the mesh area with lower complexity, making the model mapping information more reasonable. Therefore, through the model mapping information, the first rendering mesh model is transformed based on the transformation of the first physical mesh model during rendering, which can improve the effect of the transformed first rendering mesh model. Therefore, rendering the transformed first rendering mesh model can improve the rendering effect and reduce distortion.
[0070] The soft body object rendering method provided in the present application can be used to generate corresponding model mapping information for any soft body object. The model mapping information can be understood as the mapping relationship established between the physical mesh model and the rendering mesh model. The traditional method of establishing a mapping relationship between the physical mesh model and the rendering mesh model requires that the difference between the physical mesh model and the rendering mesh model cannot be too large, which limits the flexibility and diversity of making soft body objects. The soft body object rendering method provided in the present application does not require that the difference between the first physical mesh model and the first rendering mesh model cannot be too large, thereby realizing a more flexible modeling method, thereby improving the flexibility and diversity of making soft body objects.
[0071] Traditional methods for establishing a mapping relationship between a physical mesh model and a rendering mesh model can produce mapping anomalies if the physical mesh model's topology is discontinuous. If the rendering mesh model is uneven and concave, or if the rendering mesh model is multi-layered, the established mapping relationship can cause severe interlacing of the rendering mesh model when applied, resulting in poor results. However, the flexible object rendering method provided in this application is not restricted by topological continuity. Furthermore, through the complementary nature of two algorithms (i.e., establishing the relationship between points and patches, and between points), it overcomes the limitations of non-concave meshes and non-multi-layered fabrics, thereby improving mapping effectiveness and stability.
[0072] For high-precision rendering mesh models, such as in high-precision cloth simulation scenarios, the traditional method of establishing a mapping relationship between the physical mesh model and the rendering mesh model cannot meet the requirements. However, the flexible object rendering method provided by this application, through the complementary use of two algorithms (i.e., establishing the relationship between points and patches, and the relationship between points and points), can be well applied to high-precision cloth simulation scenarios.
[0073] In some embodiments, determining the relative position information between the first rendering vertex and the mapping surface includes: projecting the first rendering vertex onto the mapping surface to determine the projection point of the first rendering vertex on the mapping surface; determining first relative position information between the projection point and the mapping surface, and determining second relative position information between the projection point and the first rendering vertex; based on the first relative position information and the second relative position information, obtaining the relative position information between the first rendering vertex and the mapping surface.
[0074] The position of the projection point is related to the position of the mapping patch via the first relative position information. The position of the first rendering vertex is related to the position of the projection point via the second relative position information. The first relative position information is used to establish a relationship between the coordinates of the projection point and the coordinates of each physical vertex in the mapping patch. For example, the coordinates of the projection point are obtained by linearly transforming the coordinates of each physical vertex in the mapping patch using the first relative position information. The coordinates of the projection point can be expressed as a linear relationship between the first relative position information and the coordinates of each physical vertex in the mapping patch.
[0075] Specifically, the second relative position information between the projection point and the first rendering vertex may be a normal offset, where the normal offset refers to a distance required to move the projection point to the first rendering vertex along the normal direction of the mapping plane.
[0076] In some embodiments, the terminal may use the first relative position information and the second relative position information as the relative position information between the first rendering vertex and the corresponding mapping surface. That is, the relative position information between the first rendering vertex and the corresponding mapping surface includes the first relative position information and the second relative position information.
[0077] In this embodiment, since the position of the projection point is related to the position of the mapping surface through the first relative position information, the position of the first rendering vertex is related to the position of the projection point through the second relative position information, so when the position of the mapping surface changes, the first rendering vertex can be moved accordingly through the first relative position information and the second relative position information.
[0078] In some embodiments, determining the first relative position information between the projection point and the mapping patch includes: determining the first relative position information between the projection point and the mapping patch through the coordinates of each physical vertex in the mapping patch and the coordinates of the projection point; wherein the first relative position information between the projection point and the mapping patch is used to establish a linear relationship between the coordinates of each physical vertex in the mapping patch and the coordinates of the projection point.
[0079] Specifically, the first relative position information includes a first coefficient and a second coefficient. The third coefficient can be obtained by the first coefficient and the second coefficient, and the third coefficient = 1-first coefficient - second coefficient. The linear relationship between the coordinates of the projection point and the coordinates of each physical vertex in the mapping patch can be expressed as: P1 = a1*A1+a2*B1+(1-a1-a2)*C1. Among them, a1 is the first coefficient, a2 is the second coefficient, 1-a1-a2 is the third coefficient, A1 is the coordinate of the first vertex of the mapping patch, B1 is the coordinate of the second vertex of the mapping patch, and C1 is the coordinate of the third vertex of the mapping patch. P1 is the coordinate of the projection point. The first relative position information can be (first coefficient, second coefficient, 1-first coefficient - second coefficient), and (first coefficient, second coefficient, 1-first coefficient - second coefficient) can be called the centroid coordinates of the projection point on the mapping patch. Among them, the first coefficient, the second coefficient and the third coefficient are all values between 0 and 1.
[0080] In this embodiment, the first relative position information between the projection point and the mapping patch is used to establish a linear relationship between the coordinates of each physical vertex in the mapping patch and the coordinates of the projection point, thereby establishing a linear relationship in position between the projection point and the mapping patch using a linear relationship. Since the complexity of the linear calculation is low, the calculation efficiency is improved.
[0081] In some embodiments, the first rendering mesh model is transformed according to the model mapping information and the transformation of the first physical mesh model, and the soft body object is rendered using the transformed first rendering mesh model, including: obtaining a second physical mesh model representing the soft body object in a second form, moving physical vertices affected by external forces in the second physical mesh model to obtain the first physical mesh model affected by the external forces; obtaining a second rendering mesh model representing the soft body object in the second form, and for a first rendering vertex affected by the external force in the second rendering mesh model, determining relative position information between the first rendering vertex and a corresponding mapping surface from the model mapping information; based on the relative position information between the first rendering vertex and the corresponding mapping surface, moving the first rendering vertex affected by the external force to obtain the first rendering mesh model affected by the external force; and rendering the soft body object using the first rendering mesh model affected by the external force.
[0082] Among them, the model structure of the physical mesh model of the soft body object in different forms is the same, that is, the vertices, edges, and patches included are the same, but the positions of the vertices are different. If the position of the vertex changes, the position of the edge and patch will change. Similarly, the model structure of the rendering mesh model of the soft body object in different forms is also unchanged. Only the positions of the vertices, edges, and patches change. The model structure of the first physical mesh model is consistent with that of the second physical mesh model, and the model structure of the first rendering mesh model is consistent with that of the second rendering mesh model. For example, if the number of vertices of the first physical mesh model is 1000, the number of vertices of the second physical mesh model is also 1000, and the connection relationship of these 1000 vertices in the first physical mesh model is consistent with the connection relationship in the second physical mesh model. The difference is that the positions (i.e., coordinates) of some or all of the vertices are inconsistent. For another example, if the number of vertices in the first rendering mesh model is 3000, the number of vertices in the second rendering mesh model is also 3000, and the connection relationship of these 3000 vertices in the first rendering mesh model is consistent with the connection relationship in the second rendering mesh model. The difference is that the positions (i.e., coordinates) of some or all of the vertices are inconsistent.
[0083] External forces are forces applied to a soft body by objects outside of it. For example, in a virtual scene, external forces can be forces generated by objects in contact with the soft body. For example, if the soft body is a multi-layered garment, a character wearing the garment will exert forces on the garment during movement, causing it to deform. Alternatively, external forces can be forces exerted on the object by wind in the virtual scene.
[0084] The model mapping information includes relative position information between a first rendering vertex and a corresponding mapping surface patch, and also includes relative position information between a second rendering vertex and a corresponding mapping physical vertex.
[0085] Specifically, the terminal can perform physical simulation on the second physical grid model, thereby moving the physical vertices in the second physical grid model that are affected by the external force, and obtaining the first physical grid model after being affected by the external force. All or part of the physical vertices of the second physical grid model are affected by the external force. The physical simulation is used to determine the position change of the physical vertex under the influence of the external force, thereby moving the physical vertex according to the position change to obtain the first physical grid model after being affected by the external force.
[0086] In some embodiments, the terminal can determine the coordinates of each physical vertex in the mapping patch from the second physical mesh model, and perform a linear transformation on the coordinates of each physical vertex of the mapping patch using the first relative position information to obtain the coordinates of the projection point of the first rendering vertex in the second physical mesh model on the mapping patch. Because the position of the mapping patch in the first physical mesh model and the second physical mesh model may be different, the coordinates of the projection point in the second physical mesh model may be different from the coordinates of the projection point in the first physical mesh model. Specifically, the terminal can calculate the coordinates of the projection point of the first rendering vertex in the second physical mesh model on the mapping patch using the formula P2 = a1*A2+a2*B2+(1-a1-a2)*C2. Where P2 refers to the coordinates of the projection point of the first rendering vertex in the second physical mesh model on the mapping patch. a1 and a2 represent the first relative position information. A2 represents the coordinates of the first vertex of the mapping patch in the second physical mesh model, B2 represents the coordinates of the second vertex of the mapping patch in the second physical mesh model, and C2 represents the coordinates of the third vertex of the mapping patch in the second physical mesh model.
[0087] In some embodiments, the terminal obtains the predicted position of the first rendering vertex affected by the external force based on the coordinates of the projection point in the second physical mesh model and the second relative position information, and moves the first rendering vertex affected by the external force in the second rendering mesh model to the predicted position to obtain the first rendering mesh model affected by the external force, thereby indirectly applying the influence of the external force to the second rendering mesh model, so that the rendering mesh model affected by the external force presents the effect of being affected by the external force. Specifically, the second relative position information can be a normal offset, and the normal offset refers to the distance required to move the projection point to the first rendering vertex along the normal direction of the mapping plane. The terminal determines the position where the distance between the projection point and the normal direction of the mapping plane is equal to the normal offset, and uses this position as the predicted position of the first rendering vertex.
[0088] In some embodiments, the terminal may determine a portion of the flexible body object affected by the external force, obtain the portion affected by the external force, and determine each physical vertex in the second physical mesh model representing the portion affected by the external force as a physical vertex affected by the external force. The terminal may determine a portion of the flexible body object affected by the external force, obtain the portion affected by the external force, and determine each first rendering vertex in the second rendering mesh model representing the portion affected by the external force as a first rendering vertex affected by the external force.
[0089] In this embodiment, since the accuracy of the first physical mesh model is lower than that of the first rendering mesh model, the number of vertices affected by external forces in the first physical mesh model is less than the number of vertices affected by external forces in the first rendering mesh model. For example, a part of the soft body object is affected by an external force, and the number of vertices representing the part in the first physical mesh model is 10, while the number of vertices representing the part in the first rendering mesh model is 100. Since the complexity of moving vertices according to external forces is relatively high, the vertices in the second physical mesh model are first moved according to the external force, and then the second rendering mesh model is moved according to the relative position information, thereby reducing the computational complexity and improving the computational efficiency.
[0090] In some embodiments, determining a mapping patch corresponding to a first rendering vertex from each patch of the first physical mesh model includes: determining a neighboring patch of the first rendering vertex from each patch of the first physical mesh model, the first rendering vertex being located in a bounding box of the neighboring patch; and determining a mapping patch corresponding to the first rendering vertex based on the neighboring patch of the first rendering vertex.
[0091] The bounding box of the adjacent facets refers to a geometric body that encloses the adjacent facets. The bounding box can be a geometric body of any shape, including but not limited to a cube or a cuboid.
[0092] Specifically, the terminal can generate a bounding box for the face in the first physical mesh model, determine the bounding box where the first rendering vertex is located from the generated bounding boxes to obtain the adjacent bounding box of the first rendering vertex, and determine the face corresponding to the adjacent bounding box as the adjacent face of the first rendering vertex.
[0093] In some embodiments, when there is only one adjacent patch to the first rendering vertex, the terminal may determine the adjacent patch as the mapping patch corresponding to the first rendering vertex. When there are multiple adjacent patches to the first rendering vertex, the terminal may determine any one of the adjacent patches as the mapping patch corresponding to the first rendering vertex.
[0094] In this embodiment, the first rendering vertex is located in the bounding box of the adjacent patch, so that the mapping patch is adjacent to the first rendering vertex, which improves the rationality of the mapping patch.
[0095] In some embodiments, determining a mapping patch corresponding to the first rendering vertex based on the neighboring patches of the first rendering vertex includes: for each neighboring patch, projecting the first rendering vertex onto the plane where the neighboring patch is located to obtain a projection point of the first rendering vertex on the plane where the neighboring patch is located; determining the mapping patch corresponding to the first rendering vertex from each neighboring patch; and the projection point of the first rendering vertex on the plane where the mapping patch is located is located in the mapping patch.
[0096] Specifically, for each neighboring patch, if the projection point of the first rendering vertex on the plane where the mapping patch is located is located in the mapping patch, the neighboring patch is determined as a candidate neighboring patch.
[0097] In some embodiments, if there is only one candidate neighboring patch, the candidate neighboring patch is determined as the mapping patch corresponding to the first rendering vertex. If there are multiple candidate neighboring patches, any candidate neighboring patch is determined as the mapping patch corresponding to the first rendering vertex.
[0098] In this embodiment, since the projection point of the first rendering vertex on the plane where the mapping patch is located is located in the mapping patch, the rationality of the mapping patch is improved.
[0099] In some embodiments, determining the neighboring patches of the first rendering vertex from the patches of the first physical mesh model includes: generating corresponding bounding boxes for the patches in the first physical mesh model; the bounding boxes corresponding to the patches refer to the geometric bodies that enclose the patches; determining the bounding box where the first rendering vertex is located from the generated bounding boxes to obtain neighboring bounding boxes; and determining the patches corresponding to the neighboring bounding boxes as the neighboring patches of the first rendering vertex.
[0100] Specifically, the terminal may generate a corresponding bounding box for each facet in the first physical mesh model, and determine the bounding box where the first rendering vertex is located from the generated bounding boxes to obtain a neighboring bounding box.
[0101] In some embodiments, the terminal may generate corresponding bounding boxes for some of the facets in the first physical mesh model, and determine the bounding box where the first rendering vertex is located from the generated bounding boxes to obtain adjacent bounding boxes. For example, the terminal may determine the facets that meet the angle condition from the first physical mesh model based on the normal vectors of the physical vertices in the facets and the face normal vectors of the facets, and generate corresponding bounding boxes for the facets in the first physical mesh model other than the facets that meet the angle condition.
[0102] Physical vertices and patches have normal vectors. The patch's normal vector is called the face normal vector. The angle condition includes at least one of the following: the minimum vector angle is greater than a first angle threshold, or the maximum vector angle is greater than a second angle threshold. The vector angle refers to the angle between the physical vertex's normal vector and the face normal vector.
[0103] In this embodiment, since the first rendering vertex is located in the bounding box of the adjacent facet, the first rendering vertex is adjacent to the adjacent facet, thereby improving the accuracy of the determined adjacent facet.
[0104] In some embodiments, generating a corresponding bounding box for a patch in a first physical mesh model includes: for each patch of the first physical mesh model, obtaining the normal vector of each physical vertex in the patch and the surface normal vector of the patch; determining the vector angle between the normal vector of each physical vertex and the surface normal vector; determining the first patch that meets the angle condition from each of the first physical mesh models based on the vector angle; wherein the angle condition includes at least one of the minimum vector angle being greater than a first angle threshold or the maximum vector angle being greater than a second angle threshold; generating a corresponding bounding box for a second patch other than the first patch in the first physical mesh model.
[0105] The first angle threshold is less than the second angle threshold. The first angle threshold and the second angle threshold can be less than or equal to 90 degrees, for example, the first angle threshold is 60 degrees or 50 degrees, and the second angle threshold is 90 degrees or 85 degrees. The first patch satisfies at least one of the following conditions: the minimum vector angle is greater than the first angle threshold or the maximum vector angle is greater than the second angle threshold.
[0106] Specifically, the facets in the first physical mesh model are triangular facets. For each facet, the facet includes a first physical vertex, a second physical vertex, and a third physical vertex. The angle between the normal vector of the first physical vertex and the surface normal vector of the facet is the first angle, the angle between the normal vector of the second physical vertex and the surface normal vector of the facet is the second angle, and the angle between the normal vector of the third physical vertex and the surface normal vector of the facet is the third angle. The terminal selects the smallest one from the first angle, the second angle, and the third angle to obtain the minimum angle, and selects the largest one to obtain the maximum angle. When the terminal determines that the minimum angle is greater than the first angle threshold, or the maximum angle is greater than the second angle threshold, it determines that the facet is the first facet. The terminal generates a corresponding bounding box for the second facet other than the first facet in the first physical mesh model.
[0107] In some embodiments, the terminal traverses each patch in the first physical mesh model and determines the first patch and the second patch from each patch. To speed up the traversal of the patches, the terminal may perform a hash calculation on the coordinates of each physical vertex of the patch and search for the corresponding patch based on the calculated hash value.
[0108] In this embodiment, since the first facet meets the angle condition, the vertex normal of the first facet is far away from the normal of the facet, which is not conducive to the projection of the vertex onto the facet, while the second facet does not meet the angle condition, which is more conducive to the facet projection, thereby improving the accuracy of determining the mapping facet.
[0109] In some embodiments, determining a mapped physical vertex corresponding to a second rendering vertex from each physical vertices of the first physical mesh model includes: determining a target patch corresponding to the second rendering vertex from each patch of the first physical mesh model; the second rendering vertex is located in a bounding box of the target patch; determining a distance between each physical vertex of each target patch and the second rendering vertex; and determining a mapped physical vertex corresponding to the second rendering vertex from each physical vertex of each target patch based on the distance between each physical vertex of each target patch and the second rendering vertex.
[0110] Specifically, the terminal may generate a corresponding bounding box for each facet in the first physical mesh model, determine the bounding box where the second rendering vertex is located from the bounding box of each facet, obtain a target bounding box, and determine the facet corresponding to the target bounding box as the target facet corresponding to the second rendering vertex. There may be one or more target faces, and multiple refers to at least two.
[0111] In some embodiments, for each physical vertex in each target patch, the terminal calculates the distance between the physical vertex and the second rendering vertex, and determines the physical vertex with the smallest distance as the mapped physical vertex corresponding to the second rendering vertex.
[0112] In this embodiment, based on the distance between each physical vertex of each target face and the second rendering vertex, the mapped physical vertex corresponding to the second rendering vertex is determined from the physical vertices of each target face, so that the physical vertex with the closest distance can be determined as the mapped physical vertex, thereby improving the rationality of the mapped physical vertex.
[0113] In some embodiments, the first rendering mesh model is transformed according to the model mapping information and the transformation of the first physical mesh model, and the transformed first rendering mesh model is used to render the flexible body object, including: obtaining a second physical mesh model representing the flexible body object in a second form, moving physical vertices affected by external forces in the second physical mesh model to obtain the first physical mesh model affected by the external forces; obtaining a second rendering mesh model representing the flexible body object in the second form, and for a second rendering vertex affected by the external force in the second rendering mesh model, determining relative position information between the second rendering vertex and a corresponding mapped physical vertex from the model mapping information; based on the relative position information between the second rendering vertex and the corresponding mapped physical vertex, moving the second rendering vertex affected by the external force to obtain the first rendering mesh model affected by the external forces; and rendering the flexible body object using the first rendering mesh model affected by the external forces.
[0114] The relative position information between the second rendering vertex and the corresponding mapped physical vertex is used to establish a relationship between the coordinates of the mapped physical vertex and the coordinates of the second rendering vertex. For example, the relative position information can be an affine transformation matrix, which is used to establish a relationship between the coordinates of the mapped physical vertex and the coordinates of the second rendering vertex. The result of transforming the physical mapping vertex using the affine transformation matrix is the coordinates of the second rendering vertex. For example, if the affine transformation matrix is M, the coordinates of the mapped physical vertex are P1, and the coordinates of the second rendering vertex are P2, then P2 = P1 × M.
[0115] Specifically, because the positions, i.e., coordinates, of the same physical vertex in the first and second physical mesh models may differ, the second rendering vertex can be moved accordingly when the mapped physical vertex changes, based on the relative position information between the second rendering vertex and the corresponding mapped physical vertex. This allows the external force to be indirectly applied to the second rendering vertex, and the second external force to be indirectly applied to the second rendering mesh model, causing the first rendering mesh model to exhibit the effect of the external force.
[0116] In some embodiments, the terminal determines the position of the mapped physical vertex from the second physical mesh model to obtain a first position, and transforms the first position based on the relative position information between the second rendering vertex and the corresponding mapped physical vertex to obtain a predicted position of the second rendering vertex. For example, the relative position information between the second rendering vertex and the corresponding mapped physical vertex is an affine transformation matrix M, and the coordinates of the mapped physical vertex in the second physical mesh model are P3. Then, the predicted position of the second rendering vertex is P4 = P3 × M. Where P4 is the predicted position of the second rendering vertex.
[0117] In some embodiments, the terminal may determine a portion of the soft body object affected by the external force, obtain the external force affected portion, and determine each second rendering vertex representing the external force affected portion in the second rendering mesh model as a second rendering vertex affected by the external force.
[0118] In some embodiments, at least one first rendering vertex in the second rendering mesh model is affected by an external force, and at least one second rendering vertex in the second rendering mesh is affected by the external force. The terminal moves the physical vertex in the second physical mesh model affected by the external force to obtain the first physical mesh model affected by the external force, determines relative position information between the first rendering vertex and the corresponding mapping facet from model mapping information for the first rendering vertex in the second rendering mesh model affected by the external force, moves the first rendering vertex affected by the external force based on the relative position information between the first rendering vertex and the corresponding mapping facet, and determines relative position information between the second rendering vertex and the corresponding mapping physical vertex from the model mapping information for the second rendering vertex in the second rendering mesh model affected by the external force, moves the second rendering vertex affected by the external force based on the relative position information between the second rendering vertex and the corresponding mapping physical vertex, and obtains the first rendering mesh model affected by the external force.
[0119] In some embodiments, when the soft body object is a multi-layered costume of a character, during real-time rendering, the terminal first uses the second physical mesh model to perform skeleton skinning on the character. Skeleton skinning refers to binding the character's skeleton to the physical vertices in the second physical mesh model so that the movement of the skeleton drives the movement of the physical vertices. As shown in (1) of Figure 3, the skeleton is shown, and (2) of Figure 3 shows the result after the skeleton is skinned by the second physical mesh model, including the skeleton and the second physical mesh model. Then, the terminal performs physical simulation on the second physical mesh model. Figure 3 (3) shows the result after physical simulation. It can be seen that some physical vertices in the second physical mesh model in Figure 3 (1) and Figure 3 (3) have moved. After the physical simulation, the first physical mesh model affected by the external force is obtained. Then, the terminal can move the rendering vertices in the second rendering mesh model according to the model mapping information and the first physical mesh model affected by the external force to obtain the first rendering mesh model affected by the external force. Figure 3 (4) shows the first rendering mesh model affected by the external force. Figure 3 (4) also shows the first physical mesh model affected by the external force for the convenience of observation. The entire process shown in Figure 3 can be called cloth simulation mapping, a computer graphics technique used to simulate and render various types of cloth materials. By finely controlling deformable surfaces and incorporating physical simulation algorithms, we can achieve cloth motion and deformation effects. Furthermore, the rendering process also requires consideration of factors such as lighting, shadows, and reflections to further enhance visual quality. As can be seen, cloth simulation mapping involves three stages: skinning, physical simulation, and mapping. For example, Figure 4 shows the first rendered mesh model after being affected by external forces, using a multi-layered soft body object as an example.
[0120] In this embodiment, since the accuracy of the first physical mesh model is lower than that of the first rendering mesh model, the number of vertices affected by external forces in the first physical mesh model is less than the number of vertices affected by external forces in the first rendering mesh model. For example, a part of the soft body object is affected by an external force, and the number of vertices representing the part in the first physical mesh model is 10, while the number of vertices representing the part in the first rendering mesh model is 100. Since the complexity of moving vertices according to external forces is relatively high, the vertices in the second physical mesh model are first moved according to the external force, and then the second rendering mesh model is moved according to the relative position information, thereby reducing the computational complexity and improving the computational efficiency.
[0121] In some embodiments, the method further includes: in response to setting a label value for a rendering vertex in a first type of mesh area in the first rendering mesh model, and in response to setting a label value for a rendering vertex in a second type of mesh area in the first rendering mesh model, obtaining a label value for each rendering vertex in the first rendering mesh model; the label value set for the rendering vertex in the first type of mesh area is less than a label threshold, and the label value set for the rendering vertex in the second type of mesh area is greater than or equal to the label threshold; using the rendering vertex in the first type of mesh area in the first rendering mesh model as the first rendering vertex, including: determining, from the first rendering mesh model, a rendering vertex whose label value is less than the label threshold, to obtain the first rendering vertex; using the rendering vertex in the second type of mesh area in the first rendering mesh model as the second rendering vertex, including: determining, from the first rendering mesh model, a rendering vertex whose label value is greater than or equal to the label threshold, to obtain the second rendering vertex.
[0122] The label values are all numerical values, such as integers or positive integers greater than or equal to 0. Each rendered vertex in a first-type mesh area can be assigned the same label value. Setting a label value for a mesh area means setting label values for the vertices in the mesh area. The label threshold can be set as needed. For example, if the label threshold is 10,000, the label value of the first rendered vertex is less than 10,000, and the label value of the second rendered vertex is greater than or equal to 10,000. Each first-type mesh area can be assigned the same label value or different label values. For example, if two first-type mesh areas represent the same component of a flexible body object, the two first-type mesh areas can be assigned the same label value. For example, if the flexible body object is a multi-layered garment that includes pants, and the pants are represented by two first-type mesh areas, the two first-type mesh areas can be assigned the same label value. However, if the two first-type mesh areas represent different components of the flexible body object, for example, one representing pants and the other representing a ribbon, the two first-type mesh areas can be assigned different label values.
[0123] Specifically, the terminal can achieve the purpose of setting the label value through the three-dimensional modeling software. For example, the three-dimensional modeling software can provide a brush tool for setting vertex weights, and the weights set in the brush tool can be set as label values, and the label values are set for the mesh area through the brush tool. The three-dimensional modeling software can be, for example, 3ds Max. 3ds Max is a three-dimensional modeling, animation, rendering and visualization software. As shown in Figure 5, in step 502, the first physical mesh model and the first rendering mesh model are imported. The "multi-layer mesh" in the "brush control multi-layer mesh editing weight" in step 504 refers to the first physical mesh model or the first rendering mesh model. The first physical mesh model may include multi-layer meshes, and multi-layer refers to at least two layers. For example, the soft body object is a complex garment, and the complex garment includes a skirt and a ribbon. Then, two layers of meshes are used in the first physical mesh model to represent the skirt and the ribbon respectively. "Weight" refers to the label value. Step 504 means setting the label value through the brush tool.
[0124] In some embodiments, the terminal uses the rendering vertices in the first rendering mesh model whose tag values are less than the tag threshold as the first rendering vertex, and uses the rendering vertices in the first rendering mesh model whose tag values are greater than or equal to the tag threshold as the second rendering vertex. As shown in Figure 5, step 506 "Weight of point on mesh" refers to the tag value of the rendering vertex, the weight value in "Weight value >= 10000" refers to the tag value, and 10000 refers to the tag threshold. If the weight value is >= 10000, step 510 is executed. Step 510 "Performing point-to-point local mapping" refers to determining the mapped physical vertex corresponding to the second rendering vertex.
[0125] In this embodiment, the first type of mesh area is conveniently and accurately distinguished from the second type of mesh by setting a label value. Rendering vertices having label values less than a label threshold are determined from the first rendering mesh model to obtain first rendering vertices. Rendering vertices having label values greater than or equal to the label threshold are determined from the first rendering mesh model to obtain second rendering vertices. Thus, the first rendering vertices and the second rendering vertices belonging to different types of mesh areas are accurately obtained.
[0126] In some embodiments, if the first type of mesh area in the first physical mesh model and the first type of mesh area in the first rendering mesh model represent the same part of the soft body object, then the label value of the first type of mesh area in the first physical mesh model and the label value of the first type of mesh area in the first rendering mesh model have a corresponding relationship; determining the mapping surface corresponding to the first rendering vertex from each patch of the first physical mesh model includes: determining the label value of the first rendering vertex to obtain a first label value, determining a label value corresponding to the first label value to obtain a second label value; determining the surface with the second label value from the first physical mesh model to obtain a candidate surface; determining the mapping surface corresponding to the first rendering vertex from each candidate surface, so that the projection point of the first rendering vertex on the plane where the corresponding mapping surface is located is located in the mapping surface corresponding to the first rendering vertex.
[0127] Similar to the first rendering mesh model, the first physical mesh model can be divided into a first type of mesh area and a second type of mesh area. Each physical vertex of the candidate face has a second label value.
[0128] Specifically, each physical vertex in the first physical mesh model is also assigned a label value. In response to setting label values for a first-type mesh region in the first physical mesh model and setting label values for a second-type mesh region in the first physical mesh model, the computer device obtains label values for each physical vertex in the first physical mesh model. Similarly, for the first physical mesh model, the label values assigned to the physical vertices in the first-type mesh region are less than a label threshold, while the label values assigned to the physical vertices in the second-type mesh region are greater than or equal to the label threshold.
[0129] In some embodiments, if a first-type mesh region in the first physical mesh model and a first-type mesh region in the first rendering mesh model represent the same portion of a flexible body object, then the label value of the first-type mesh region in the first physical mesh model and the label value of the first-type mesh region in the first rendering mesh model have a corresponding relationship. Therefore, because the first label value corresponds to the second label value, the candidate patch and the first rendering vertex correspond to the same portion of the flexible body object.
[0130] In some embodiments, the label value set for the first type of mesh region in the first physical mesh model is an even number, and the label value set for the first type of mesh region in the first rendering mesh model is an odd number. If the first type of mesh region A in the first physical mesh model and the first type of mesh region B in the first rendering mesh model represent the same part of the soft body object, the label value of mesh region A and the label value of mesh region B are adjacent odd-even numbers, for example, the label value of mesh region A is 2n, and the label value of mesh region B is 2n+1. As shown in Figure 5, if the weight value is <10000, step 508 is executed, and if the weight value is greater than or equal to 10000, step 510 is executed. The "odd-even relationship" in step 508, "mapping points to triangle centroids based on the even-odd relationship," refers to the relationship between 2n and 2n+1. If the first label value is less than 10000, for example, if the first label value is 4, the second label value is 5 based on the "odd-even relationship." The "point to triangle barycentric mapping" in step 508 refers to determining the mapping patch corresponding to the first rendering vertex in the first physical mesh model, with the first relative position information being the barycentric coordinates of the projection point. Step 512, "integrating pre-computed mapping data during the baking phase," refers to generating model mapping information corresponding to the soft body object based on the relative position information. The pre-computed mapping data refers to the model mapping information. Step 514, "performing real-time mapping during the cloth simulation based on the pre-computed mapping data," refers to performing real-time mapping based on the model mapping information. The real-time mapping process involves: for a first rendering vertex in the second rendering mesh model affected by an external force, determining the relative position information between the first rendering vertex and the corresponding mapping patch from the model mapping information. Based on this relative position information, the first rendering vertex affected by the external force is moved. Furthermore, for a second rendering vertex in the second rendering mesh model affected by the external force, determining the relative position information between the second rendering vertex and the corresponding mapped physical vertex from the model mapping information. Based on this relative position information, the second rendering vertex affected by the external force is moved, thereby obtaining the first rendering mesh model affected by the external force. As shown in Figure 6, a schematic diagram of setting label values for a physical mesh model is shown. Figure 6 shows the physical mesh model corresponding to the multi-layered clothing worn by the character, and shows the weights set for each mesh area of the physical mesh model, that is, the label values. Similarly, Figure 7 shows the rendered mesh model corresponding to the multi-layered clothing worn by the character, and shows each mesh area in the rendered mesh model. The brush tool can be used to set the corresponding weight, that is, the label value, for each mesh area. Taking the multi-layered clothing worn by the character as an example, as shown in Figure 8, a schematic diagram of "integrating mapping pre-calculated data in the baking stage" is shown, that is, obtaining model mapping information. The 30% in Figure 8 represents the progress of obtaining model mapping information.
[0131] In some embodiments, after obtaining each candidate patch, the terminal determines the neighboring patch of the first rendering vertex from each candidate patch. The first rendering vertex is located within the bounding box of the neighboring patch. The terminal then projects the first rendering vertex onto the plane where the neighboring patch is located to obtain the projection point of the first rendering vertex on the plane where the neighboring patch is located. The terminal can determine the mapping patch corresponding to the first rendering vertex from each neighboring patch. The projection point of the first rendering vertex on the plane where the mapping patch is located is located within the mapping patch.
[0132] In this embodiment, since the candidate patch and the first rendering vertex correspond to the same part of the soft body object, the mapping patch and the first rendering vertex correspond to the same part of the soft body object, for example, both correspond to pants, thereby improving the rationality of the mapping patch and the rationality of the model mapping information, thereby improving the rendering effect.
[0133] In some embodiments, as shown in FIG9 , a method for rendering a soft body object is provided. The method can be executed by a terminal or jointly by a terminal and a server. The method is described using the terminal as an example, and includes the following steps:
[0134] Step 902: Obtain a first physical mesh model and a first rendering mesh model of the flexible body object in a preset first state, wherein the accuracy of the first physical mesh model is lower than the accuracy of the second rendering mesh model.
[0135] Step 904 : Determine a first rendering vertex and a second rendering vertex from the first rendering mesh model.
[0136] The first rendering vertex is a rendering vertex in a first type of mesh area in the first rendering mesh model. The second rendering vertex is a rendering vertex in a second type of mesh area in the first rendering mesh model. The complexity of the second type of mesh area is higher than the complexity of the first type of mesh area.
[0137] Step 906: Determine the mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, project the first rendering vertex onto the mapping patch, determine the projection point of the first rendering vertex on the mapping patch, determine the first relative position information between the projection point and the mapping patch, and determine the second relative position information between the projection point and the first rendering vertex.
[0138] The position of the projection point is related to the position of the mapping patch through the first relative position information, and the position of the first rendering vertex is related to the position of the projection point through the second relative position information;
[0139] Step 908 : Obtain relative position information between the first rendering vertex and the mapping patch based on the first relative position information and the second relative position information.
[0140] Step 910 : Determine a mapped physical vertex corresponding to the second rendering vertex from the physical vertices of the first physical mesh model, and determine relative position information between the second rendering vertex and the corresponding mapped physical vertex.
[0141] Step 912: Generate model mapping information corresponding to the soft body object based on the relative position information.
[0142] Step 914 : During the real-time rendering process, the physical vertices in the second physical mesh model affected by the external force are moved to obtain the first physical mesh model affected by the external force.
[0143] Step 916: For the first rendering vertex affected by the external force in the second rendering mesh model, determine the relative position information between the first rendering vertex and the corresponding mapping surface from the model mapping information, and move the first rendering vertex affected by the external force based on the relative position information between the first rendering vertex and the corresponding mapping surface.
[0144] Step 918: For the second rendering vertex affected by the external force in the second rendering mesh model, determine the relative position information between the second rendering vertex and the corresponding mapped physical vertex from the model mapping information. Based on the relative position information between the second rendering vertex and the corresponding mapped physical vertex, move the second rendering vertex affected by the external force to obtain the first rendering mesh model after being affected by the external force.
[0145] Step 920 : Render the soft body object using the first rendering mesh model affected by the external force.
[0146] In this embodiment, the relationship between vertices in the mesh area with higher complexity is established, and the relationship between vertices and patches is established in the mesh area with lower complexity, so that the model mapping information is more reasonable. Therefore, through the model mapping information, the first rendering mesh model is transformed based on the transformation of the first physical mesh model during rendering, which can improve the effect of the transformed first rendering mesh model, and thus rendering the transformed first rendering mesh model can improve the rendering effect.
[0147] The soft body object rendering method provided in this application can be applied to any virtual scene to generate soft body objects in the virtual scene. The virtual scenes include but are not limited to film and television special effects, games, visual design, virtual reality, and digital cultural and creative scenes.
[0148] For example, in a game scene, a soft body object can be a multi-layered garment worn by a character, and the multi-layered garment can be a single layer or multiple layers. In order to render the multi-layered garment in the game scene in real time, the terminal can obtain the multi-layered garment in a first physical mesh model and a first rendering mesh model, and determine the first rendering vertex and the second rendering vertex from the first rendering mesh model. The terminal can determine the mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, project the first rendering vertex onto the mapping patch, determine the projection point of the first rendering vertex on the mapping patch, determine the first relative position information between the projection point and the mapping patch, and determine the second relative position information between the projection point and the first rendering vertex. The terminal can obtain the relative position information between the first rendering vertex and the mapping patch based on the first relative position information and the second relative position information. The terminal can determine the mapping physical vertex corresponding to the second rendering vertex from each physical vertex of the first physical mesh model, determine the relative position information between the second rendering vertex and the corresponding mapping physical vertex, and generate model mapping information corresponding to the multi-layered garment based on each relative position information.
[0149] During the real-time rendering of the multi-layer clothing, the terminal obtains a second physical mesh model of the multi-layer clothing in its current state and a second rendering mesh model in its current state. The terminal moves the physical vertices affected by the external force in the second physical mesh model to obtain the first physical mesh model affected by the external force. For the first rendering vertex affected by the external force in the second rendering mesh model, the terminal determines the relative position information between the first rendering vertex and the corresponding mapping facet from the model mapping information. Based on the relative position information between the first rendering vertex and the corresponding mapping facet, the terminal moves the first rendering vertex affected by the external force. For the second rendering vertex affected by the external force in the second rendering mesh model, the terminal determines the relative position information between the second rendering vertex and the corresponding mapping physical vertex from the model mapping information. Based on the relative position information between the second rendering vertex and the corresponding mapping physical vertex, the terminal moves the second rendering vertex affected by the external force to obtain the first rendering mesh model affected by the external force. The terminal then renders the first rendering mesh model affected by the external force to obtain the rendering result of the multi-layer clothing.
[0150] The soft body object rendering method provided in this application, when applied to game scenes, can improve the flexibility and diversity of game production, improve production efficiency and quality, improve mapping effects and stability, improve simulation effects and accuracy, etc., and provide more possibilities and flexibility for the implementation of cloth simulation.
[0151] In some application scenarios, taking the soft body object as a curtain on a building as an example, the terminal can obtain the curtain in the first physical mesh model and the first rendering mesh model, and determine the first rendering vertex and the second rendering vertex from the first rendering mesh model. The terminal can determine the mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, project the first rendering vertex onto the mapping patch, determine the projection point of the first rendering vertex on the mapping patch, determine the first relative position information between the projection point and the mapping patch, and determine the second relative position information between the projection point and the first rendering vertex. The terminal can obtain the relative position information between the first rendering vertex and the mapping patch based on the first relative position information and the second relative position information. The terminal can determine the mapping physical vertex corresponding to the second rendering vertex from each physical vertex of the first physical mesh model, determine the relative position information between the second rendering vertex and the corresponding mapping physical vertex, and generate model mapping information corresponding to the curtain based on each relative position information.
[0152] During the real-time rendering of the curtain, the terminal obtains a second physical mesh model of the curtain in its current state and a second rendering mesh model in its current state. The terminal moves the physical vertices affected by the external force in the second physical mesh model to obtain the first physical mesh model affected by the external force. For the first rendering vertex affected by the external force in the second rendering mesh model, the terminal determines the relative position information between the first rendering vertex and the corresponding mapping facet from the model mapping information. Based on the relative position information between the first rendering vertex and the corresponding mapping facet, the terminal moves the first rendering vertex affected by the external force. For the second rendering vertex affected by the external force in the second rendering mesh model, the terminal determines the relative position information between the second rendering vertex and the corresponding mapping physical vertex from the model mapping information. Based on the relative position information between the second rendering vertex and the corresponding mapping physical vertex, the terminal moves the second rendering vertex affected by the external force to obtain the first rendering mesh model affected by the external force. The terminal then renders the first rendering mesh model affected by the external force to obtain a rendering result of the curtain.
[0153] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0154] Based on the same inventive concept, embodiments of the present application also provide a flexible body object rendering device for implementing the flexible body object rendering method described above. The solution provided by this device is similar to the solution described in the method described above. Therefore, the specific limitations of one or more flexible body object rendering device embodiments provided below can be found in the limitations of the flexible body object rendering method described above and will not be repeated here.
[0155] In some embodiments, as shown in FIG10 , a soft body object rendering apparatus is provided, comprising: a mesh model acquisition module 1002 , a first information determination module 1004 , a second information determination module 1006 , a mapping information determination module 1008 , and a simulation module 1010 , wherein:
[0156] The mesh model acquisition module 1002 is used to acquire a first physical mesh model and a first rendering mesh model of the flexible body object in a preset first form, wherein the accuracy of the first physical mesh model is lower than that of the first rendering mesh model.
[0157] The first information determination module 1004 is configured to use a rendering vertex in a first type of mesh area in a first rendering mesh model as a first rendering vertex, determine a mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, and determine relative position information between the first rendering vertex and the mapping patch.
[0158] A second information determination module 1006 is configured to use a rendering vertex in a second type of mesh area in the first rendering mesh model as a second rendering vertex, determine a mapped physical vertex corresponding to the second rendering vertex from the physical vertices of the first physical mesh model, and determine relative position information between the second rendering vertex and the corresponding mapped physical vertex, wherein the complexity of the second type of mesh area is greater than the complexity of the first type of mesh area.
[0159] The mapping information determining module 1008 is configured to generate model mapping information corresponding to the soft body object based on the relative position information.
[0160] The rendering module 1010 is configured to transform the first rendering mesh model according to the model mapping information and the transformation of the first physical mesh model when rendering the flexible body object, and render the flexible body object using the transformed first rendering mesh model.
[0161] In some embodiments, the first information determination module 1004 is further used to project the first rendering vertex onto the mapping surface to determine the projection point of the first rendering vertex on the mapping surface; determine the first relative position information between the projection point and the mapping surface, and determine the second relative position information between the projection point and the first rendering vertex; based on the first relative position information and the second relative position information, obtain the relative position information between the first rendering vertex and the mapping surface.
[0162] In some embodiments, the first information determination module 1004 is also used to determine the first relative position information between the projection point and the mapping patch through the coordinates of each physical vertex in the mapping patch and the coordinates of the projection point; wherein the first relative position information between the projection point and the mapping patch is used to establish a linear relationship between the coordinates of each physical vertex in the mapping patch and the coordinates of the projection point.
[0163] In some embodiments, the rendering module 1010 is further used to obtain a second physical mesh model representing the soft body object in the second form, move the physical vertices affected by the external force in the second physical mesh model, and obtain a first physical mesh model affected by the external force; obtain a second rendering mesh model representing the soft body object in the second form, and for a first rendering vertex affected by the external force in the second rendering mesh model, determine the relative position information between the first rendering vertex and the corresponding mapping surface from the model mapping information; based on the relative position information between the first rendering vertex and the corresponding mapping surface, move the first rendering vertex affected by the external force to obtain the first rendering mesh model affected by the external force; and render the soft body object using the first rendering mesh model affected by the external force.
[0164] In some embodiments, the first information determination module 1004 is further used to determine the neighboring patches of the first rendering vertex from each patch of the first physical mesh model, where the first rendering vertex is located in the bounding box of the neighboring patches; and determine the mapping patch corresponding to the first rendering vertex based on the neighboring patches of the first rendering vertex.
[0165] In some embodiments, the first information determination module 1004 is further used to project the first rendering vertex onto the plane where the adjacent facet is located for each adjacent facet, to obtain a projection point of the first rendering vertex on the plane where the adjacent facet is located; and determine the mapping facet corresponding to the first rendering vertex from each adjacent facet, and the projection point of the first rendering vertex on the plane where the mapping facet is located is located in the mapping facet.
[0166] In some embodiments, the first information determination module 1004 is further used to generate a bounding box that surrounds the face in the first physical mesh model; determine the bounding box where the first rendering vertex is located from the generated bounding boxes to obtain an adjacent bounding box; and determine the face corresponding to the adjacent bounding box as the adjacent face of the first rendering vertex.
[0167] In some embodiments, the first information determination module 1004 is also used to obtain the normal vector of each physical vertex in the patch and the surface normal vector of the patch for each patch of the first physical mesh model; determine the vector angle between the normal vector of each physical vertex and the surface normal vector; determine the first patch that meets the angle condition from each first physical mesh model based on the vector angle; wherein the angle condition includes at least one of the minimum vector angle being greater than a first angle threshold or the maximum vector angle being greater than a second angle threshold; and generate a bounding box surrounding the second patch for the second patch other than the first patch in the first physical mesh model.
[0168] In some embodiments, the second information determination module 1006 is further used to determine the target face corresponding to the second rendering vertex from each face of the first physical mesh model, where the second rendering vertex is located in the bounding box of the target face; determine the distance between each physical vertex of each target face and the second rendering vertex; and determine the mapping physical vertex corresponding to the second rendering vertex from each physical vertex of each target face based on the distance between each physical vertex of each target face and the second rendering vertex.
[0169] In some embodiments, the rendering module 1010 is further configured to obtain a second physical mesh model representing the flexible body object in the second form, move physical vertices affected by the external force in the second physical mesh model, and obtain a first physical mesh model affected by the external force; obtain a second rendering mesh model representing the flexible body object in the second form, and determine, from model mapping information, relative position information between a second rendering vertex affected by the external force and a corresponding mapped physical vertex in the second rendering mesh model; move the second rendering vertex affected by the external force based on the relative position information between the second rendering vertex and the corresponding mapped physical vertex to obtain the first rendering mesh model affected by the external force; and render the flexible body object using the first rendering mesh model affected by the external force.
[0170] In some embodiments, the apparatus 1000 further includes a label processing module configured to obtain a label value for each rendering vertex in the first rendering mesh model in response to setting a label value for the rendering vertices in a first type of mesh area in the first rendering mesh model, and in response to setting a label value for the rendering vertices in a second type of mesh area in the first rendering mesh model; the label value set for the rendering vertex in the first type of mesh area is less than a label threshold, and the label value set for the rendering vertex in the second type of mesh area is greater than or equal to the label threshold;
[0171] In some embodiments, the first information determining module 1004 is further configured to determine, from the first rendering mesh model, rendering vertices having label values less than a label threshold, to obtain first rendering vertices.
[0172] In some embodiments, the second information determining module 1006 is further configured to determine, from the first rendering mesh model, rendering vertices having label values greater than or equal to a label threshold, to obtain second rendering vertices.
[0173] In some embodiments, if the first type of mesh region in the first physical mesh model and the first type of mesh region in the first rendering mesh model represent the same portion of the soft body object, then the label value of the first type of mesh region in the first physical mesh model and the label value of the first type of mesh region in the first rendering mesh model have a corresponding relationship.
[0174] The first information determination module 1004 is further configured to determine a label value of the first rendering vertex to obtain a first label value, determine a label value corresponding to the first label value to obtain a second label value; determine a patch with a label value of the second label value in the first physical mesh model to obtain a candidate patch; and determine a mapping patch corresponding to the first rendering vertex from each candidate patch, so that a projection point of the first rendering vertex on the plane where the corresponding mapping patch is located is located in the mapping patch corresponding to the first rendering vertex.
[0175] Each module in the flexible object rendering device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0176] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be shown in Figure 11. The computer device includes a processor, a memory, an input / output interface (I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data involved in the soft body object rendering method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a soft body object rendering method is implemented.
[0177] In some embodiments, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in Figure 12. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner may be implemented through WiFi, a mobile cellular network, NFC (near field communication), or other technologies. When the computer program is executed by the processor, it implements a method for rendering a soft body object. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0178] Those skilled in the art will understand that the structures shown in Figures 11 and 12 are merely block diagrams of partial structures related to the solution of the present application, and do not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figures, or combine certain components, or have a different component arrangement.
[0179] In some embodiments, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above-mentioned soft body object rendering method when executing the computer program.
[0180] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned soft body object rendering method are implemented.
[0181] In some embodiments, a computer program product is provided, including a computer program, which implements the steps in the above-mentioned soft body object rendering method when executed by a processor.
[0182] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0183] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0184] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0185] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A method for rendering a soft body object, executed by a computer device, the method comprising: Acquire a first physical mesh model and a first rendering mesh model of the soft body object in a preset first form, wherein the accuracy of the first physical mesh model is less than the accuracy of the first rendering mesh model; Taking a rendering vertex in a first type of mesh area in the first rendering mesh model as a first rendering vertex, determining a mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, and determining relative position information between the first rendering vertex and the mapping patch; taking a rendering vertex in a second type of mesh area in the first rendering mesh model as a second rendering vertex, determining a mapped physical vertex corresponding to the second rendering vertex from each physical vertex of the first physical mesh model, and determining relative position information between the second rendering vertex and the corresponding mapped physical vertex, wherein the complexity of the second type of mesh area is higher than that of the first type of mesh area; Generate model mapping information corresponding to the soft body object based on each of the relative position information; and When rendering the soft body object, the first rendering mesh model is transformed according to the model mapping information and the transformation of the first physical mesh model, and the soft body object is rendered using the transformed first rendering mesh model.
2. The method according to claim 1, wherein determining the relative position information between the first rendering vertex and the mapping patch comprises: Projecting the first rendering vertex onto the mapping surface to determine a projection point of the first rendering vertex on the mapping surface; Determine first relative position information between the projection point and the mapping patch, and determine second relative position information between the projection point and the first rendering vertex; Based on the first relative position information and the second relative position information, relative position information between the first rendering vertex and the mapping patch is obtained.
3. According to the method of claim 2, the determining the first relative position information between the projection point and the mapping surface patch comprises: Determining first relative position information between the projection point and the mapping surface patch through the coordinates of each physical vertex in the mapping surface patch and the coordinates of the projection point; The first relative position information between the projection point and the mapping patch is used to establish a linear relationship between the coordinates of each physical vertex in the mapping patch and the coordinates of the projection point.
4. The method according to claim 2 or 3, wherein the first rendering mesh model is transformed according to the model mapping information and the transformation of the first physical mesh model, and the soft body object is rendered using the transformed first rendering mesh model, comprising: Acquire a second physical mesh model representing the soft body object in a second state, move physical vertices affected by the external force in the second physical mesh model, and obtain a first physical mesh model affected by the external force; Acquire a second rendering mesh model representing the flexible body object in a second state, and determine, for a first rendering vertex affected by an external force in the second rendering mesh model, relative position information between the first rendering vertex and a corresponding mapping surface patch from the model mapping information; Based on the relative position information between the first rendering vertex and the corresponding mapping surface patch, the first rendering vertex affected by the external force is moved to obtain a first rendering mesh model affected by the external force; The soft body object is rendered using the first rendering mesh model affected by the external force.
5. The method according to any one of claims 1 to 4, wherein determining the mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model comprises: Determine a neighboring patch of the first rendering vertex from each patch of the first physical mesh model, wherein the first rendering vertex is located in a bounding box of the neighboring patch; A mapping patch corresponding to the first rendering vertex is determined based on neighboring patches of the first rendering vertex.
6. The method according to claim 5, wherein determining the mapping patch corresponding to the first rendering vertex based on the neighboring patches of the first rendering vertex comprises: For each of the adjacent face patches, project the first rendering vertex onto the plane where the adjacent face patch is located to obtain a projection point of the first rendering vertex on the plane where the adjacent face patch is located; A mapping patch corresponding to the first rendering vertex is determined from each of the neighboring patches, and a projection point of the first rendering vertex on the plane where the mapping patch is located is located in the mapping patch.
7. The method according to claim 5 or 6, wherein determining the neighboring facets of the first rendering vertex from the facets of the first physical mesh model comprises: Generating a bounding box surrounding the face patch in the first physical mesh model; Determine the bounding box where the first rendering vertex is located from the generated bounding boxes to obtain an adjacent bounding box; The facet corresponding to the neighboring bounding box is determined as the neighboring facet of the first rendering vertex.
8. The method according to claim 7, wherein generating a bounding box surrounding the face piece in the first physical mesh model comprises: For each patch of the first physical mesh model, obtain the normal vector of each physical vertex in the patch and the surface normal vector of the patch; Determine the vector angles between the normal vectors of each of the physical vertices and the surface normal vector; Determine a first facet satisfying an angle condition from each of the first physical mesh models based on the vector angle; wherein the angle condition includes at least one of a minimum vector angle being greater than a first angle threshold or a maximum vector angle being greater than a second angle threshold; For a second patch other than the first patch in the first physical mesh model, a bounding box surrounding the second patch is generated.
9. The method according to any one of claims 1 to 8, wherein determining the mapped physical vertex corresponding to the second rendering vertex from the physical vertices of the first physical mesh model comprises: Determine a target facet corresponding to a second rendering vertex from each facet of the first physical mesh model, wherein the second rendering vertex is located in a bounding box of the target facet; Determine the distance between each physical vertex of each target patch and the second rendering vertex; Based on the distance between each physical vertex of each target patch and the second rendering vertex, a mapping physical vertex corresponding to the second rendering vertex is determined from the physical vertices of each target patch.
10. The method according to claim 9, wherein the first rendering mesh model is transformed according to the model mapping information and the transformation of the first physical mesh model, and the soft body object is rendered using the transformed first rendering mesh model, comprising: Acquire a second physical mesh model representing the soft body object in a second state, move physical vertices affected by the external force in the second physical mesh model, and obtain a first physical mesh model affected by the external force; Acquire a second rendering mesh model representing the soft body object in a second state, and determine, for a second rendering vertex in the second rendering mesh model that is affected by an external force, relative position information between the second rendering vertex and a corresponding mapped physical vertex from the model mapping information; Based on the relative position information between the second rendering vertex and the corresponding mapped physical vertex, the second rendering vertex affected by the external force is moved to obtain a first rendering mesh model affected by the external force; The soft body object is rendered using the first rendering mesh model affected by the external force.
11. The method according to any one of claims 1 to 10, further comprising: In response to setting label values for rendering vertices in a first type of mesh area in the first rendering mesh model, and in response to setting label values for rendering vertices in a second type of mesh area in the first rendering mesh model, obtaining label values for rendering vertices in the first rendering mesh model; the label values set for the rendering vertices in the first type of mesh area are less than a label threshold, and the label values set for the rendering vertices in the second type of mesh area are greater than or equal to the label threshold; The step of using the rendering vertices in the first type of mesh area in the first rendering mesh model as first rendering vertices includes: Determine, from the first rendering mesh model, a rendering vertex whose label value is less than the label threshold, to obtain the first rendering vertex; The using the rendering vertices in the second type of mesh area in the first rendering mesh model as second rendering vertices includes: Determine, from the first rendering mesh model, rendering vertices whose label values are greater than or equal to the label threshold, and obtain the second rendering vertices.
12. The method according to claim 11, if the first type of mesh area in the first physical mesh model and the first type of mesh area in the first rendering mesh model represent the same part of the soft body object, then the label value of the first type of mesh area in the first physical mesh model and the label value of the first type of mesh area in the first rendering mesh model have a corresponding relationship; The determining, from each patch of the first physical mesh model, a mapping patch corresponding to the first rendering vertex comprises: Determine the label value of the first rendering vertex to obtain a first label value, and determine the label value corresponding to the first label value to obtain a second label value; Determine, from the first physical mesh model, a face with a label value of the second label value to obtain a candidate face; A mapping patch corresponding to the first rendering vertex is determined from each of the candidate patches, so that a projection point of the first rendering vertex on a plane where the corresponding mapping patch is located is located in the mapping patch corresponding to the first rendering vertex.
13. A soft body object rendering device, the device comprising: A mesh model acquisition module, used to acquire a first physical mesh model and a first rendering mesh model of the soft body object in a preset first form, wherein the accuracy of the first physical mesh model is lower than the accuracy of the first rendering mesh model; a first information determination module, configured to use a rendering vertex in a first type of mesh area in the first rendering mesh model as a first rendering vertex, determine a mapping patch corresponding to the first rendering vertex from each patch of the first physical mesh model, and determine relative position information between the first rendering vertex and the mapping patch; a second information determination module, configured to use a rendering vertex in a second type of mesh area in the first rendering mesh model as a second rendering vertex, determine a mapping physical vertex corresponding to the second rendering vertex from each physical vertex of the first physical mesh model, and determine relative position information between the second rendering vertex and the corresponding mapping physical vertex, wherein the complexity of the second type of mesh area is higher than that of the first type of mesh area; A mapping information determination module, used to generate model mapping information corresponding to the soft body object based on each relative position information; and A rendering module is used to transform the first rendering mesh model according to the model mapping information and the transformation of the first physical mesh model when rendering the soft body object, and use the transformed first rendering mesh model to render the soft body object.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 12 when executing the computer program.
15. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
16. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Cloth real-time simulation method for virtual fitting
CN108629837A
Cloth animation generation method and device and computer readable storage medium
CN111028320A
Game role model generation method and device, role adjustment method and device, equipment and medium
CN111714885A
Three-dimensional grid model copyright identification method and device, equipment and storage medium
CN115222574A
Soft object rendering method and device, computer equipment and storage medium
CN116543093A