Virtual model processing method and device, computer program product and electronic equipment
By creating a model control curve and bone in the model grid of the virtual model, combining the deformation control parameter and vertex offset, determine the weight of the skin, solve the problem of high cost and low efficiency in existing technologies, realize the realization of low -cost and low efficiency, achieve realization Efficient and smooth skin effect.
Patent Information
- Application Number
- CN202411627294.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-01-28
AI Technical Summary
The prior art is costly and inefficient when drawing skin weights of virtual models, especially in the bone binding process of deformable models such as hair and fabric, which requires a large amount of bones and time-consuming and laborious adjustment of weights.
By obtaining a variant model grid, the model control curve is created, and the model bone is created based on this curve. Use the deformation control parameter to control the model control curve to drive the model mesh body change, calculate the vertex offset and determine the weight value, and finally skin treatment.
The smooth skin effect is achieved, the drawing cost is reduced, the drawing efficiency is improved, and the time and energy of artificial operations are reduced.
Smart Images

Figure CN119379921A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a virtual model processing method, a virtual model processing device, a computer program product, and an electronic device. Background Art
[0002] As users' requirements for the visual effects of virtual models continue to increase, the design of deformable models such as hair and cloth has become more complex and sophisticated. In order to present better artistic effects, corresponding bones need to be created for hair, cloth and other deformable models for binding.
[0003] In the related technology, for deformable models such as hair and cloth, a large number of bones are often used to skin the model mesh during the bone binding process, ranging from dozens of bones to hundreds of bones. When drawing the skinning weights, it is necessary to set and adjust the weights of different parts back and forth by drawing on the model surface. The drawing cost is high, the efficiency is low, and it is time-consuming and labor-intensive.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The present disclosure provides a virtual model processing method, a virtual model processing device, a computer program product and an electronic device, so as to at least to some extent solve the problems of high rendering cost and low efficiency in the related art.
[0006] According to a first aspect of the present disclosure, a virtual model processing method is provided, the method comprising: obtaining a model mesh corresponding to a deformable model, creating a model control curve in the model mesh, and creating a model skeleton based on the model control curve; based on a deformation control parameter, controlling the model control curve to drive the model mesh to deform, so as to obtain a vertex offset of each model vertex in the model mesh; based on the vertex offset of each model vertex in the model mesh, determining a weight value of each model vertex in the model mesh; based on the weight value of each model vertex in the model mesh, performing skinning on the model skeleton and the model mesh.
[0007] According to a second aspect of the present disclosure, a virtual model processing device is provided, the device comprising: a curve creation module, used to obtain a model mesh corresponding to a deformable model, and create a model control curve in the model mesh, and create a model skeleton based on the model control curve; a mesh deformation module, used to control the model control curve to drive the model mesh to deform based on a deformation control parameter, so as to obtain a vertex offset of each model vertex in the model mesh; a weight determination module, used to determine a weight value of each model vertex in the model mesh based on the vertex offset of each model vertex in the model mesh; and a skinning processing module, used to perform skinning on the model skeleton and the model mesh based on the weight value of each model vertex in the model mesh.
[0008] According to a third aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the virtual model processing method of the first aspect and possible implementation methods thereof are implemented.
[0009] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the virtual model processing method of the above-mentioned first aspect and its possible implementation method by executing the executable instructions.
[0010] The technical solution disclosed in this disclosure has the following beneficial effects:
[0011] In the above virtual model processing process, the model mesh corresponding to the deformable model is obtained, and a model control curve is created in the model mesh, and a model skeleton is created based on the model control curve; based on the deformation control parameters, the model control curve is controlled to drive the model mesh to deform, so as to obtain the vertex offset of each model vertex in the model mesh; based on the vertex offset of each model vertex in the model mesh, the weight value of each model vertex in the model mesh is determined; based on the weight value of each model vertex in the model mesh, the model skeleton and the model mesh are skinned. In the present disclosure, by drawing the model control curve, the deformation of the model control curve is transferred to the model mesh, and the weight value is determined according to the vertex offset of each model vertex in the model mesh and the deformation control parameter, a smooth skinning effect can be achieved, with lower drawing cost and higher drawing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A flowchart showing a virtual model processing method in this exemplary embodiment;
[0013] Figure 2 A schematic diagram showing a method of creating a model control curve in a hair model according to the exemplary embodiment;
[0014] Figure 3 A schematic diagram showing a model mesh body before and after deformation in this exemplary embodiment;
[0015] Figure 4 A schematic diagram showing the effect of skinning each model skeleton in a hair model in this exemplary embodiment is shown;
[0016] Figure 5A A schematic diagram showing a skinning effect produced by an automated model processing tool integrated with a virtual model processing method in this exemplary embodiment;
[0017] Figure 5B A schematic diagram showing a skinning effect produced by another automated model processing tool integrated with a virtual model processing method in this exemplary embodiment;
[0018] Figure 6 A flow chart showing a variable model skinning in this exemplary embodiment;
[0019] Figure 7 A structural block diagram of a virtual model processing device in this exemplary embodiment is shown;
[0020] Figure 8 An electronic device for implementing the above-mentioned virtual model processing method in this exemplary embodiment is shown. DETAILED DESCRIPTION
[0021] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.
[0022] The accompanying drawings are schematic diagrams of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the accompanying drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in hardware modules or integrated circuits, or in networks, processors or microcontrollers. The embodiments can be implemented in various forms and should not be construed as being limited to the examples set forth herein. The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the description below, many specific details are provided to provide a full description of the embodiments of the present disclosure. However, those skilled in the art should appreciate that one or more specific details may be omitted when implementing the technical solution of the present disclosure, or one or more specific details may be replaced by other methods, components, devices, steps, etc.
[0023] In the related technology, for deformable models such as hair and cloth, a large number of bones are often used to skin the model mesh during the bone binding process, ranging from dozens of bones to hundreds of bones. When drawing the skinning weights, it is necessary to set and adjust the weights of different parts back and forth by drawing on the model surface. The drawing cost is high, the efficiency is low, and it is time-consuming and labor-intensive.
[0024] In view of one or more of the above problems, exemplary embodiments of the present disclosure provide a virtual model processing method, a virtual model processing device, a computer program product, and an electronic device.
[0025] In an optional embodiment, reference Figure 1 As shown, a flowchart of a virtual model processing method is provided, which specifically includes the following steps S110 to S140:
[0026] Step S110, obtaining a model mesh corresponding to the deformable model, creating a model control curve in the model mesh, and creating a model skeleton based on the model control curve;
[0027] Step S120, based on the deformation control parameter, controlling the model control curve to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body;
[0028] Step S130, determining a weight value of each model vertex in the model mesh body based on the vertex offset of each model vertex in the model mesh body;
[0029] Step S140, based on the weight value of each model vertex in the model mesh, the model skeleton and the model mesh are skinned.
[0030] Figure 1 In the method shown, by drawing the model control curve, the deformation of the model control curve is transferred to the model mesh, and the weight value is determined according to the vertex offset of each model vertex in the model mesh and the deformation control parameter, a smooth skinning effect can be achieved with lower drawing cost and higher drawing efficiency.
[0031] Below Figure 1 Provide detailed instructions for each step.
[0032] In step S110, a model mesh corresponding to the deformable model is obtained, a model control curve is created in the model mesh, and a model skeleton is created based on the model control curve.
[0033] The deformable model may be a virtual model drawn by a computer and deformable in an animation, such as a hair, clothing fabric, etc. It may be an independent model or a local model, and the present disclosure does not make any specific limitation on this.
[0034] Model mesh refers to a geometric mesh structure composed of countless vertices, edges, and faces in 3D modeling, which is used to represent the surface and internal structure of the model. These meshes are composed of triangles, quadrilaterals, or other polygons, which are spliced into a complete surface to form the surface of the model.
[0035] The model control curve refers to a curve used to control the deformation degree of the surface of an object. For example, the model control curve may be a NURBS (Non uniform rational B-spline) curve, and different skinning effects may be quickly achieved by changing the NURBS curve.
[0036] Optionally, one or more model control curves may be created in the model mesh according to the initial bending shape of the deformable model.
[0037] Optionally, a plurality of control points for defining the shape of the curve may be determined in the model mesh body, and the model control curve may be obtained by connecting these control points.
[0038] Optionally, the above-mentioned creation of a model control curve in the model mesh body can be achieved by the following steps: according to the shape of the deformable model, a plurality of control points are determined in the model mesh body, and the model control curve is created based on the plurality of control points.
[0039] The shape of the deformable model may be the shape of the deformable model in the initial state. For example, the deformable model is a hair model with multiple discontinuous vertices. Figure 2 As shown, you can create model control curves in the hair model according to the direction from the root to the tip of the hair.
[0040] For example, multiple control points and weights associated therewith may be defined in the model mesh according to the shape of the deformable model, and a model control curve may be created according to the positions and weights of these control points, wherein the positions of the control points are used to define the shape of the curve, and the weights of the control points affect the degree of proximity between the curve and the control points.
[0041] By adjusting the position of the control points, the curve shape can be accurately controlled to meet the design requirements of different curve shapes.
[0042] Among them, model bones refer to bones created for deformable models.
[0043] In an optional implementation, the above-mentioned creation of the model skeleton based on the model control curve includes: obtaining position information of control points corresponding to the model control curve, and creating the model skeleton based on the position information of the control points corresponding to the model control curve.
[0044] Optionally, according to the arrangement order of the control points corresponding to the model control curve, skeleton elements may be added to these control points in sequence to construct the model skeleton.
[0045] For example, taking Maya modeling as an example, the world coordinates of each control point can be obtained through the Maya xform command, and the model skeleton can be created in sequence and the coordinate information of its control points can be assigned. After the model skeleton is created, the skinCluster command can be used to bind the model skeleton and the model mesh, so that the model mesh can deform naturally when the model skeleton moves.
[0046] Creating model bones based on model control curves can greatly reduce the number of bones created and improve skinning efficiency.
[0047] In step S120 , based on the deformation control parameter, the model control curve is controlled to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body.
[0048] The deformation control parameter refers to a control parameter used to control the deformation of the model control curve.
[0049] Optionally, the deformation control parameters may include but are not limited to displacement and displacement direction. The displacement direction may be set to the direction of a certain axis in space, which may be set in advance, and the present disclosure does not specifically limit this. The displacement is used to limit the displacement value of the control point, which may be set in advance, and the present disclosure does not specifically limit this.
[0050] For example, taking Maya modeling as an example, the wire deformer command can be used to control the model control curve to drive the model mesh to deform.
[0051] The vertex offset refers to the distance that the model vertex moves during the deformation process, which can be the distance between the position of the model vertex before the model mesh is deformed and the position of the model vertex after the deformation.
[0052] In an optional embodiment, the above-mentioned control of the model control curve based on the deformation control parameters to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body, can be achieved through the following steps: based on the displacement amount and displacement direction, control each control point in the model control curve to move so that the model control curve is deformed; transfer the deformation of the model control curve to the model mesh body to deform the model mesh body, and obtain the vertex offset of each model vertex in the model mesh body.
[0053] The greater the displacement, the greater the displacement distance of the model vertices of the model mesh.
[0054] Specifically, each control point in the model control curve can be controlled to move in the displacement direction by a distance matching the displacement amount, for example: moving 100 distance units along the z-axis to deform the model control curve, and deforming the model mesh along the deformed model control curve to deform the model mesh.
[0055] Specifically, the vertex offset of each model vertex in the model mesh body may be calculated according to the position of the model vertex before the model mesh body is deformed and the position of the model vertex after the deformation.
[0056] In an optional embodiment, the above-mentioned control of the model control curve based on the deformation control parameters to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body, can be achieved through the following steps: obtaining the first position information of each model vertex in the model mesh body; wherein the first position information is the position information of the model mesh body before deformation; based on the deformation control parameters, controlling the model control curve to drive the model mesh body to deform, and obtaining the second position information of each model vertex in the model mesh body; wherein the second position information is the position information of the model mesh body after deformation; determining the vertex offset of each model vertex in the model mesh body according to the first position information and the second position information of each model vertex in the model mesh body.
[0057] For example, Figure 3 As shown in the figure, a schematic diagram of the model mesh before and after deformation is provided. Among them, t is the displacement value, that is, the displacement amount. The initial position of the model vertex is A. After the model mesh is deformed, the new vertex position is B. If the spatial coordinates corresponding to position A are (x1, y1, z1), and the spatial coordinates corresponding to position B are (x2, y2, z2), the vertex offset can be calculated by It is obtained that d is the vertex offset. It should be noted that the vertex offset is the distance between two points in space. The model control curve drives the model to produce a smooth curvature. Therefore, the vertex offsets corresponding to different model vertices may be different and are between 0 and the displacement corresponding to the deformation control parameter.
[0058] By determining the vertex offset, data support is provided for the weight calculation of the model vertices, so that the created model skeleton can drive the deformable model to produce natural and smooth deformation.
[0059] In step S130 , a weight value of each model vertex in the model mesh is determined based on the vertex offset of each model vertex in the model mesh.
[0060] Optionally, the weight value of each model vertex in the model mesh may be positively correlated with the vertex offset of each model vertex in the model mesh, that is, the larger the vertex offset of the model vertex, the larger the weight value of the model vertex. The weight value of the model vertex may be between 0.0 and 1.0.
[0061] In an optional embodiment, the above-mentioned determination of the weight value of each model vertex in the model mesh based on the vertex offset of each model vertex in the model mesh can be achieved by the following steps: based on the ratio of the vertex offset of each model vertex in the model mesh to the displacement, determine the weight value of each model vertex in the model mesh.
[0062] Exemplarily, the weight value of the model vertex can be obtained by calculating w=d / t, wherein w represents the weight value of the model vertex, d represents the vertex offset of the model vertex, and t represents the displacement corresponding to the deformation control parameter.
[0063] The vertex offset is between 0 and the displacement corresponding to the deformation control parameter. The weight value of each model vertex in the model mesh is determined based on the ratio of the vertex offset to the displacement of each model vertex in the model mesh. The calculation process is simple and easy to implement.
[0064] In step S140, the model skeleton and the model mesh are skinned based on the weight value of each model vertex in the model mesh.
[0065] Exemplarily, taking Maya modeling as an example, the cmds.skinPercent() command can be used to assign the calculated weight value to the corresponding model vertex to complete automatic smooth skinning.
[0066] Take the deformable model as a hair model with multiple discontinuous vertices as an example. If the model bones created for the hair model include model bones b_hair_1, b_hair_2, b_hair_3, and b_hair_4, such as Figure 4 As shown, a smooth skinning effect is provided for the model bones b_hair_1, b_hair_2, b_hair_3, and b_hair_4.
[0067] For example, the above virtual model processing method can be integrated into an automated model processing tool to realize the automated skinning of a deformable model, thereby improving work efficiency and reducing labor costs and errors. Figure 5A and Figure 5B As shown, schematic diagrams of skinning effects produced by an automated model processing tool integrated with a virtual model processing method are provided.
[0068] For example, Figure 6As shown, a flow chart of variable model skinning is provided, which may specifically include the following steps:
[0069] Step S601, obtaining a model mesh body corresponding to the deformable model, determining a plurality of control points in the model mesh body, and using these control points to create a model control curve;
[0070] Step S602, obtaining the position information of the control points corresponding to the model control curve, and creating the model skeleton based on the position information of the control points corresponding to the model control curve;
[0071] Step S603, obtaining first position information of each model vertex in the model mesh body; wherein the first position information is position information of the model mesh body before deformation;
[0072] Step S604, based on the displacement amount and displacement direction in the deformation control parameter, control each control point in the model control curve to move so that the model control curve is deformed;
[0073] Step S605, transferring the deformation of the model control curve to the model mesh body, so that the model mesh body is deformed;
[0074] Step S606, obtaining second position information of each model vertex in the model mesh body; wherein the second position information is position information of the model mesh body after deformation;
[0075] Step S607, determining a vertex offset of each model vertex in the model mesh body according to the first position information and the second position information of each model vertex in the model mesh body;
[0076] Step S608, determining a weight value of each model vertex in the model mesh body based on a ratio of a vertex offset of each model vertex in the model mesh body to a displacement in the deformation control parameter;
[0077] Step S609, based on the weight value of each model vertex in the model mesh, the model skeleton and the model mesh are skinned.
[0078] Figure 6 The method shown can quickly realize skeleton skinning and obtain a smooth skinning effect, reduce costs and increase efficiency, save manpower, and facilitate iteration.
[0079] The exemplary embodiment of the present disclosure also provides a virtual model processing device, referring to Figure 7 As shown, the virtual model processing device 700 may include the following program modules:
[0080] The curve creation module 710 is used to obtain a model mesh corresponding to the deformable model, create a model control curve in the model mesh, and create a model skeleton based on the model control curve;
[0081] The mesh deformation module 720 is used to control the model control curve to drive the model mesh body to deform based on the deformation control parameter, so as to obtain the vertex offset of each model vertex in the model mesh body;
[0082] A weight determination module 730, for determining a weight value of each model vertex in the model mesh based on a vertex offset of each model vertex in the model mesh;
[0083] The skinning processing module 740 is used to perform skinning processing on the model skeleton and the model mesh based on the weight value of each model vertex in the model mesh.
[0084] In an optional embodiment, based on the aforementioned scheme, the curve creation module 710 creates a model control curve in the model mesh, which can be configured as follows: according to the morphology of the deformable model, multiple control points are determined in the model mesh, and the model control curve is created based on the multiple control points.
[0085] In an optional embodiment, based on the above-mentioned scheme, the curve creation module 710 creates a model skeleton based on the model control curve, which can be configured to: obtain the position information of the control points corresponding to the model control curve, and create the model skeleton based on the position information of the control points corresponding to the model control curve.
[0086] In an optional implementation, based on the above solution, the deformation control parameters include displacement amount and displacement direction.
[0087] In an optional embodiment, based on the aforementioned scheme, the mesh deformation module 720 can be configured to: control the movement of each control point in the model control curve based on the displacement amount and displacement direction to deform the model control curve; transfer the deformation of the model control curve to the model mesh body to deform the model mesh body, and obtain the vertex offset of each model vertex in the model mesh body.
[0088] In an optional implementation, based on the aforementioned solution, the weight determination module 730 may be configured to determine the weight value of each model vertex in the model mesh based on the ratio of the vertex offset to the displacement of each model vertex in the model mesh.
[0089] In an optional embodiment, based on the aforementioned scheme, the mesh deformation module 720 can be configured to: obtain first position information of each model vertex in the model mesh body; wherein the first position information is the position information of the model mesh body before deformation; based on the deformation control parameter, control the model control curve to drive the model mesh body to deform, and obtain second position information of each model vertex in the model mesh body; wherein the second position information is the position information of the model mesh body after deformation; determine the vertex offset of each model vertex in the model mesh body according to the first position information and the second position information of each model vertex in the model mesh body.
[0090] The specific details of each part of the above-mentioned device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.
[0091] The exemplary embodiments of the present disclosure also provide a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the virtual model processing method is implemented.
[0092] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.
[0093] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.
[0094] The code of the computer program can be written in one or more programming languages. Programming languages such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).
[0095] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure. Exemplarily, the following steps may be included:
[0096] Obtain a model mesh corresponding to the deformable model, create a model control curve in the model mesh, and create a model skeleton based on the model control curve;
[0097] Based on the deformation control parameter, the model control curve is controlled to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body;
[0098] Determine a weight value of each model vertex in the model mesh based on the vertex offset of each model vertex in the model mesh;
[0099] The model skeleton is skinned to the model mesh based on the weight values of each model vertex in the model mesh.
[0100] In an optional embodiment, based on the aforementioned scheme, the above-mentioned creation of a model control curve in a model mesh body can be achieved by the following steps: according to the morphology of the deformable model, a plurality of control points are determined in the model mesh body, and a model control curve is created based on the plurality of control points.
[0101] In an optional embodiment, based on the aforementioned scheme, the creation of a model skeleton based on the model control curve can be achieved through the following steps: obtaining the position information of the control points corresponding to the model control curve, and creating a model skeleton based on the position information of the control points corresponding to the model control curve.
[0102] In an optional implementation, based on the above solution, the deformation control parameters include displacement amount and displacement direction.
[0103] In an optional embodiment, based on the aforementioned scheme, the above-mentioned deformation control parameter-based control of the model control curve drives the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body. This can be achieved through the following steps: based on the displacement amount and displacement direction, control each control point in the model control curve to move so that the model control curve is deformed; transfer the deformation of the model control curve to the model mesh body to cause the model mesh body to deform, and obtain the vertex offset of each model vertex in the model mesh body.
[0104] In an optional embodiment, based on the aforementioned scheme, the above-mentioned determination of the weight value of each model vertex in the model mesh based on the vertex offset of each model vertex in the model mesh can be achieved by the following steps: based on the ratio of the vertex offset of each model vertex in the model mesh to the displacement, determine the weight value of each model vertex in the model mesh.
[0105] In an optional embodiment, based on the aforementioned scheme, the above-mentioned deformation control parameter-based control of the model control curve drives the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body, which can be achieved through the following steps: obtaining the first position information of each model vertex in the model mesh body; wherein the first position information is the position information of the model mesh body before deformation; based on the deformation control parameter, controlling the model control curve to drive the model mesh body to deform, and obtaining the second position information of each model vertex in the model mesh body; wherein the second position information is the position information of the model mesh body after deformation; determining the vertex offset of each model vertex in the model mesh body according to the first position information and the second position information of each model vertex in the model mesh body.
[0106] In the above steps, by drawing the model control curve, the deformation of the model control curve is transferred to the model mesh, and the weight value is determined according to the vertex offset of each model vertex in the model mesh and the deformation control parameter, a smooth skinning effect can be achieved with lower drawing cost and higher drawing efficiency.
[0107] The exemplary embodiment of the present disclosure also provides an electronic device capable of implementing the above-mentioned virtual model processing method. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor executes the method in the exemplary embodiment by executing the executable instructions. In addition, the electronic device may also include a display for displaying a graphical user interface.
[0108] Reference below Figure 8 , the electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that Figure 8 The electronic device 800 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0109] like Figure 8 As shown, the electronic device 800 may include: a processor 810 , a memory 820 , a bus 830 , an I / O (input / output) interface 840 , a network adapter 850 , and a display 860 .
[0110] The memory 820 may include a volatile memory, such as a RAM 821, a cache unit 822, and may also include a non-volatile memory, such as a ROM 823. The memory 820 may also include one or more program modules 824, such program modules 824 include but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. For example, the program module 824 may include each module in the above-mentioned device.
[0111] The processor 810 may include one or more processing units. For example, the processor 810 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc.
[0112] The processor 810 may be configured to execute executable instructions stored in the memory 820 , such as executing any one or more method steps in the exemplary embodiment.
[0113] Exemplarily, the processor 810 may perform the following steps:
[0114] Obtain a model mesh corresponding to the deformable model, create a model control curve in the model mesh, and create a model skeleton based on the model control curve;
[0115] Based on the deformation control parameter, the model control curve is controlled to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body;
[0116] Determine a weight value of each model vertex in the model mesh based on the vertex offset of each model vertex in the model mesh;
[0117] The model skeleton is skinned to the model mesh based on the weight values of each model vertex in the model mesh.
[0118] In an optional embodiment, based on the aforementioned scheme, the above-mentioned creation of a model control curve in a model mesh body can be achieved by the following steps: according to the morphology of the deformable model, a plurality of control points are determined in the model mesh body, and a model control curve is created based on the plurality of control points.
[0119] In an optional embodiment, based on the aforementioned scheme, the creation of a model skeleton based on the model control curve can be achieved through the following steps: obtaining the position information of the control points corresponding to the model control curve, and creating a model skeleton based on the position information of the control points corresponding to the model control curve.
[0120] In an optional implementation, based on the above solution, the deformation control parameters include displacement amount and displacement direction.
[0121] In an optional embodiment, based on the aforementioned scheme, the above-mentioned deformation control parameter-based control of the model control curve drives the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body. This can be achieved through the following steps: based on the displacement amount and displacement direction, control each control point in the model control curve to move so that the model control curve is deformed; transfer the deformation of the model control curve to the model mesh body to cause the model mesh body to deform, and obtain the vertex offset of each model vertex in the model mesh body.
[0122] In an optional embodiment, based on the aforementioned scheme, the above-mentioned determination of the weight value of each model vertex in the model mesh based on the vertex offset of each model vertex in the model mesh can be achieved by the following steps: based on the ratio of the vertex offset of each model vertex in the model mesh to the displacement, determine the weight value of each model vertex in the model mesh.
[0123] In an optional embodiment, based on the aforementioned scheme, the above-mentioned deformation control parameter-based control of the model control curve drives the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body, which can be achieved through the following steps: obtaining the first position information of each model vertex in the model mesh body; wherein the first position information is the position information of the model mesh body before deformation; based on the deformation control parameter, controlling the model control curve to drive the model mesh body to deform, and obtaining the second position information of each model vertex in the model mesh body; wherein the second position information is the position information of the model mesh body after deformation; determining the vertex offset of each model vertex in the model mesh body according to the first position information and the second position information of each model vertex in the model mesh body.
[0124] In the above steps, by drawing the model control curve, the deformation of the model control curve is transferred to the model mesh, and the weight value is determined according to the vertex offset of each model vertex in the model mesh and the deformation control parameter, a smooth skinning effect can be achieved with lower drawing cost and higher drawing efficiency.
[0125] The bus 830 is used to realize the connection between different components of the electronic device 800, and may include a data bus, an address bus, and a control bus.
[0126] The electronic device 800 can communicate with one or more external devices 900 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 840 .
[0127] The electronic device 800 can communicate with one or more networks through the network adapter 850. For example, the network adapter 850 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. The network adapter 850 can communicate with other modules of the electronic device 800 through the bus 830.
[0128] The electronic device 800 may display a graphical user interface and the like through the display 860 .
[0129] although Figure 8 Not shown, other hardware and / or software modules may also be provided in the electronic device 800, including but not limited to: a display, a microcode, a device driver, a redundant processor, an external disk drive array, a RAID (Redundant Arrays of Independent Disks) system, a tape drive, and a data backup storage system.
[0130] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0131] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as a system, method or program product. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be collectively referred to herein as a "circuit", "module" or "system". Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptive changes of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and implementation are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0132] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A virtual model processing method, characterized in that: The method comprises: Obtain a model mesh corresponding to the deformable model, create a model control curve in the model mesh, and create a model skeleton based on the model control curve; Based on the deformation control parameter, controlling the model control curve to drive the model mesh body to deform, so as to obtain the vertex offset of each model vertex in the model mesh body; Determining a weight value of each model vertex in the model mesh body based on a vertex offset of each model vertex in the model mesh body; The model skeleton and the model mesh are skinned based on the weight value of each model vertex in the model mesh.
2. The method according to claim 1, characterized in that: The step of creating a model control curve in the model mesh body comprises: According to the shape of the deformable model, a plurality of control points are determined in the model mesh, and a model control curve is created based on the plurality of control points.
3. The method according to claim 2, characterized in that The step of creating a model skeleton based on the model control curve comprises: The position information of the control points corresponding to the model control curve is obtained, and the model skeleton is created based on the position information of the control points corresponding to the model control curve.
4. The method according to claim 1, characterized in that The deformation control parameters include displacement amount and displacement direction.
5. The method according to claim 4, characterized in that The step of controlling the model control curve to drive the model mesh body to deform based on the deformation control parameter to obtain the vertex offset of each model vertex in the model mesh body includes: Based on the displacement amount and the displacement direction, controlling each control point in the model control curve to move so that the model control curve is deformed; The deformation of the model control curve is transferred to the model mesh body so that the model mesh body is deformed, and the vertex offset of each model vertex in the model mesh body is obtained.
6. The method according to claim 4, characterized in that The step of determining a weight value of each model vertex in the model mesh body based on the vertex offset of each model vertex in the model mesh body comprises: Based on the ratio of the vertex offset of each model vertex in the model mesh body to the displacement, a weight value of each model vertex in the model mesh body is determined.
7. The method according to claim 1, characterized in that The step of controlling the model control curve to drive the model mesh body to deform based on the deformation control parameter to obtain the vertex offset of each model vertex in the model mesh body includes: Acquire first position information of each model vertex in the model mesh body; wherein the first position information is position information of the model mesh body before deformation; Based on the deformation control parameter, the model control curve is controlled to drive the model mesh body to deform, and second position information of each model vertex in the model mesh body is obtained; wherein the second position information is position information of the model mesh body after deformation; Determine a vertex offset of each model vertex in the model mesh according to the first position information and the second position information of each model vertex in the model mesh.
8. A virtual model processing device, characterized in that: The device comprises: A curve creation module, used for obtaining a model mesh corresponding to the deformable model, creating a model control curve in the model mesh, and creating a model skeleton based on the model control curve; A mesh deformation module, used for controlling the model control curve to drive the model mesh body to deform based on the deformation control parameter, so as to obtain the vertex offset of each model vertex in the model mesh body; A weight determination module, used to determine a weight value of each model vertex in the model mesh body based on a vertex offset of each model vertex in the model mesh body; The skinning processing module is used to perform skinning on the model skeleton and the model mesh based on the weight value of each model vertex in the model mesh.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.