Deformation method and device of virtual model and electronic equipment

By utilizing shaders in the graphics processor to handle vertex transformation calculations, the problem of wasted resources and computational performance during virtual model deformation is solved, and efficient vertex data updates are achieved.

CN121564282APending Publication Date: 2026-02-24NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511500393.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

In existing technologies, the frequent creation and deletion of arrays during the deformation process of virtual models leads to resource waste, and the calculation of vertex change logic depends on the CPU, resulting in wasted computing performance.

Method used

By using shaders to process vertex transformation calculations in the graphics processor, simple and repetitive vertex transformation calculations can be performed in parallel, and the initial vertex data can be updated using the central processing unit, avoiding frequent creation and deletion of arrays.

Benefits of technology

This reduces the waste of resources and computing power, and improves the efficiency and performance of virtual model deformation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121564282A_ABST
    Figure CN121564282A_ABST
Patent Text Reader

Abstract

The invention provides a virtual model deformation method and device and electronic equipment, and the method comprises the steps: determining a deformed second spline line in response to a deformation instruction for a first spline line; sending the control point data of the first spline line and the second spline line and the initial vertex data of the virtual model to a graphics processor; calculating target vertex data after deformation of the virtual model based on the control point data and the initial vertex data through a shader running in a graphics processor; and sending the target vertex data to a central processing unit, and updating the initial vertex data based on the target vertex data through the central processing unit to obtain a deformed virtual model. In the mode, the shader running in the graphics processor is used for processing calculation of vertex transformation, simple and repeated vertex transformation calculation is completed in parallel on the graphics processor, and the central processing unit is used for updating the initial vertex data based on the calculation result, so that frequent creation and deletion of arrays are avoided; and the waste of resources and computing performance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus and electronic device for deforming a virtual model. Background Technology

[0002] In some games, players need to deform virtual models within the game scene. Related technologies typically use Bézier splines to drive the movement of mesh vertices. Each model transformation requires updating the vertices through reconstruction, specifically calculating the transformed vertex information, deleting the original mesh, and instantiating a new mesh based on the transformed vertex information. This frequent creation and deletion of arrays leads to resource waste. Furthermore, the aforementioned calculations involving vertex changes are all performed by the CPU, resulting in wasted computational performance. Summary of the Invention

[0003] In view of this, the purpose of this disclosure is to provide a method, apparatus and electronic device for deforming a virtual model, which uses shaders running in a graphics processor to process vertex transformation calculations, performs simple and repetitive vertex transformation calculations in parallel on the graphics processor, and uses a central processing unit to update the initial vertex data based on the calculation results, so as to avoid frequent creation and deletion of arrays, thereby reducing the waste of resources and computing performance.

[0004] In a first aspect, embodiments of this disclosure provide a method for deforming a virtual model, which provides a graphical user interface through a terminal device. The graphical user interface displays a virtual model, and the virtual model corresponds to a first spline. The method includes: determining a deformed second spline in response to a deformation instruction for the first spline; sending control point data of the first spline, control point data of the second spline, and initial vertex data of the virtual model to a graphics processor; calculating target vertex data of the deformed virtual model based on the control point data of the first spline, control point data of the second spline, and initial vertex data of the virtual model using a shader running in the graphics processor; sending the target vertex data of the virtual model to a central processing unit (CPU); updating the initial vertex data of the virtual model based on the target vertex data using the CPU to obtain the deformed virtual model; and displaying the deformed virtual model on the graphical user interface.

[0005] Secondly, embodiments of this disclosure provide a deformation device for a virtual model, which provides a graphical user interface (GUI) via a terminal device. The GUI displays a virtual model, and the virtual model corresponds to a first spline. The device includes: a spline determination module, used to determine a deformed second spline in response to a deformation command for the first spline; a data transmission module, used to send control point data of the first spline, control point data of the second spline, and initial vertex data of the virtual model to a graphics processor; a data calculation module, used to calculate target vertex data of the deformed virtual model based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model using a shader running in the graphics processor; and a data update module, used to send the target vertex data of the virtual model to a central processing unit (CPU), and update the initial vertex data of the virtual model based on the target vertex data using the CPU to obtain the deformed virtual model, and display the deformed virtual model on the GUI.

[0006] Thirdly, embodiments of this disclosure provide an electronic device including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the deformation method of the virtual model of any of the first aspects.

[0007] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the deformation method of the virtual model of any of the first aspects.

[0008] The embodiments disclosed herein bring the following beneficial effects: This disclosure provides a method, apparatus, and electronic device for deforming a virtual model. In response to a deformation command for a first spline, a second spline after deformation is determined. Control point data of the first spline, control point data of the second spline, and initial vertex data of the virtual model are sent to a graphics processor (GPU). A shader running on the GPU calculates target vertex data of the deformed virtual model based on the control point data of the first and second splines and the initial vertex data of the virtual model. The target vertex data of the virtual model is sent to a central processing unit (CPU). The CPU updates the initial vertex data of the virtual model based on the target vertex data to obtain the deformed virtual model, which is then displayed on a graphical user interface. In this method, the vertex transformation calculation is handled by a shader running on the GPU, allowing simple and repetitive vertex transformation calculations to be performed in parallel on the GPU. The CPU updates the initial vertex data based on the calculation results, avoiding frequent creation and deletion of arrays, thereby reducing resource and computational performance waste.

[0009] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description, claims and drawings.

[0010] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0012] Figure 1 A flowchart of a deformation method for a virtual model provided in this disclosure embodiment; Figure 2 A flowchart of another virtual model deformation method provided in this disclosure embodiment; Figure 3 A schematic diagram of the structure of a deformation device for a virtual model provided in an embodiment of this disclosure; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0014] Currently, some games require players to deform virtual models within the game scene. Related technologies typically use Bézier splines to drive the movement of mesh vertices. Each model transformation requires updating the vertices through reconstruction, specifically calculating the transformed vertex information, directly deleting the original mesh, and instantiating a new mesh based on the transformed vertex information for replacement. This frequent creation and deletion of arrays leads to resource waste. Furthermore, the aforementioned logical calculations regarding vertex changes are all performed by the CPU, resulting in wasted computational performance. Therefore, this disclosure provides a method, apparatus, and electronic device for deforming virtual models, which can be applied to devices such as mobile phones, laptops, tablets, and computers.

[0015] In one embodiment of this disclosure, the virtual model deformation method can run on a local terminal device or a server. When the virtual model deformation method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and client devices.

[0016] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separate. The storage and execution of virtual model deformation methods are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses game screen data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.

[0017] In an optional implementation, taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally by downloading, installing, and running the game program via an electronic device. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device can include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.

[0018] In one possible implementation, embodiments of the present invention provide a method for deforming a virtual model, providing a graphical user interface through a terminal device. The terminal device can be the aforementioned local terminal device or a client device in the aforementioned cloud interaction system. The graphical user interface displays a virtual model, which corresponds to a first straight line. This first straight line can be a Bézier curve, a B-spline, a non-uniform rational B-spline, etc., and includes control point data for the first straight line. Figure 1 As shown, the method includes the following steps: Step S102: In response to the deformation command for the first spline, determine the deformed second spline; In response to a control operation on the first line, a deformation instruction is generated; the control operation can be a drag operation, a click operation, or a double-click operation, such as a drag operation or a click operation on the screen, or a drag operation or a mouse click operation on the first line while the mouse is pressed.

[0019] In this embodiment, the first spline mentioned above usually refers to a Bézier curve. The central processing unit determines the deformed second spline in response to the deformation instruction for the first spline.

[0020] In actual implementation, in response to the deformation instruction for the first spline, initialization is performed first, and then the deformed second spline is determined. Initialization includes at least the following steps: First, determine if there is a virtual model component (such as a MeshFilter component) that stores the shape of the virtual model (such as mesh data). MeshFilter is a component in the Unity engine.

[0021] Second, determine whether the initial vertex data of the virtual model (such as the original mesh) is stored. The initial vertex data includes: vertex position coordinates, normals, tangents, and bitangents.

[0022] Third, determine whether the control point data for the first line corresponding to the virtual model is stored. This control point data is usually stored in the BezierSpline component. The control point data includes: the position coordinates of the control point, normals, tangents, and secondary tangents, etc.

[0023] Fourth, determine whether a shader (such as a compute shader) is running in the graphics processor.

[0024] If any component or data is missing, the system will abort initialization and report an error. It should be noted that if normal or tangent data is missing from the initial vertex data, it will usually be calculated automatically.

[0025] Fifth, extract the position coordinates, normals, tangents, and other geometric data of each vertex from the initial vertex data, and determine the coordinate values ​​of the specified coordinate axes in the initial vertex data.

[0026] Sixth, calculate the mapping value corresponding to each vertex (the specific calculation process will be explained later), and store the mapping value corresponding to the vertex in the initial vertex data.

[0027] Seventh, create three graphics processor buffers. The first buffer (VertexBuffer) is used to store vertex data, specifically including initial vertex data and deformed target vertex data; the second buffer (BezierControlPoints) is used to store the control point data of the deformed second spline; and the third buffer (OriginalBezierPoints) is used to store the control point data of the first spline.

[0028] Eighth, subscribe to the BezierSpline's OnSplineUpdated event. This event-driven mechanism ensures that recalculation is only triggered when the first line (Bezier curve) changes, avoiding unnecessary performance overhead.

[0029] In response to the deformation command for the first line, the BezierSpline component detects the position change and triggers the OnSplineUpdated event. This event marks the beginning of the entire deformation loop.

[0030] Step S104: Send the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor. The control point data of the first spline mentioned above includes the position coordinates, normal, tangent, and other data of each control point in the first spline; the control point data of the second spline mentioned above includes the position coordinates, normal, tangent, and other data of each control point in the second spline; the initial vertex data mentioned above includes the position coordinates, normal, tangent, and corresponding mapping value of each vertex.

[0031] Optionally, the control point data of the first spline is sent to the first buffer of the graphics processor; the control point data of the second spline is sent to the second buffer of the graphics processor; and the initial vertex data of the virtual model is sent to the third buffer of the graphics processor.

[0032] This operation ensures that vertex transformation calculations in the graphics processor use the latest control point data. It also sets the `needsMeshUpdate` flag to inform the system that deformation calculations need to be performed in the next frame. Furthermore, the buffer allows for efficient data transfer and sharing between the central processing unit and the graphics processor.

[0033] Step S106: Using the shader running in the graphics processor, based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model, calculate the target vertex data of the virtual model after deformation. The aforementioned shader typically refers to a computational shader. Specifically, based on the control point data of the first spline and the control point data of the second spline, it determines the deformation (such as rotation and displacement) of each vertex in the virtual model. Then, based on the vertex's deformation, it determines the target vertex data after deformation. The target vertex data includes the vertex's position coordinates, normals, and tangents.

[0034] It should be noted that after obtaining the target vertex data after the virtual model is deformed, the target vertex data after the virtual model is deformed is stored in the third buffer.

[0035] Step S108: The target vertex data of the virtual model is sent to the central processing unit. The central processing unit updates the initial vertex data of the virtual model based on the target vertex data to obtain the deformed virtual model, and displays the deformed virtual model on the graphical user interface.

[0036] After the calculations are completed in the graphics processor, the deformation results (i.e., the target vertex data of the virtual model) are synchronized from the third buffer to the central processing unit. Then, the initial vertex data is updated to obtain the deformed virtual model, which is then displayed in the graphical user interface, allowing users to see the real-time deformation effect.

[0037] This disclosure provides a method for deforming a virtual model. In response to a deformation instruction for a first spline, a second spline after deformation is determined. Control point data of the first and second splines, along with initial vertex data of the virtual model, are sent to a graphics processor (GPU). A shader running on the GPU calculates target vertex data of the deformed virtual model based on the control point data of the first and second splines and the initial vertex data of the virtual model. The target vertex data is then sent to a central processing unit (CPU). The CPU updates the initial vertex data of the virtual model based on the target vertex data, resulting in the deformed virtual model, which is then displayed on a graphical user interface. This method utilizes a shader running on the GPU to handle vertex transformation calculations, performing simple and repetitive vertex transformation calculations in parallel on the GPU. The CPU updates the initial vertex data based on the calculation results, avoiding frequent array creation and deletion, thereby reducing resource and computational performance waste.

[0038] The initial vertex data mentioned above includes the mapping values ​​corresponding to the vertices. These mapping values ​​are used to determine the positions of the vertices in the first line. The mapping values ​​corresponding to the vertices are determined in the following way: ;in, The mapping value of the vertex. The coordinate values ​​of the specified coordinate axis for the vertex. The minimum value among the coordinates of all vertices of the virtual model on a specified axis. The difference between the maximum and minimum coordinate values ​​of all vertices of the virtual model on a specified axis.

[0039] in, This indicates that the point in the first spline that influences the vertices is the starting point of the spline. This indicates that the point in the first spline that affects the vertex is the endpoint of the spline. This indicates that the point in the first spline that influences the vertex is the midpoint of the spline. The mapping value determines which position on the first spline influences that vertex.

[0040] See Figure 2 Another method for deforming a virtual model is shown in this embodiment. This embodiment mainly describes the specific implementation of step S106 above, which involves calculating the target vertex data of the deformed virtual model based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model. Specifically, it includes: Step S202: In response to the deformation command for the first spline, determine the deformed second spline; Step S204: Send the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor. Step S206: By using the shader running in the graphics processor, for each vertex in the virtual model, based on the mapping value corresponding to the current vertex, determine the position data of the first position point affecting the current vertex from the first spline, and determine the position data of the second position point affecting the current vertex from the second spline; In one approach, interpolation is performed between the start and end points of the first spline based on the mapping value corresponding to the current vertex to obtain the first position point affecting the current vertex. Then, based on the position coordinates of the first position point, its normal, tangent, and other data are calculated to obtain the position data of the first position point. Similarly, based on the mapping value corresponding to the current vertex, interpolation is performed between the start and end points of the second spline to obtain the second position point affecting the current vertex. Then, based on the position coordinates of the second position point, its normal, tangent, and other data are calculated to obtain the position data of the second position point.

[0041] For example, if the mapping value corresponding to the current vertex is 0.3, interpolation at a position three-tenths of the distance between the start and end points of the first line can yield the first position point that affects the current vertex.

[0042] In another approach, each point on both the first and second splines has a corresponding positional proportion, which corresponds to a mapping value. For example, the positional proportion of the midpoint of the spline is 0.5, corresponding to a mapping value of 0.5. Based on the mapping value corresponding to the current vertex, the position point corresponding to the mapping value is determined from the positional proportions of all points on the first spline, thus obtaining the first position point affecting the current vertex. Then, based on the position coordinates of the first position point, its normal, tangent, and other data are calculated to obtain the position data of the first position point. Similarly, based on the mapping value corresponding to the current vertex, the position point corresponding to the mapping value is determined from the positional proportions of all points on the second spline, thus obtaining the second position point affecting the current vertex. Then, based on the position coordinates of the second position point, its normal, tangent, and other data are calculated to obtain the position data of the second position point.

[0043] Optionally, the shaders compute the target vertex data for each vertex in the virtual model in parallel.

[0044] Step S208: Based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex, determine the target vertex data after the current vertex has undergone deformation.

[0045] In one approach, the displacement and rotation of the current vertex are determined based on the position data of the first and second position points. The position of the current vertex is updated based on the displacement, and the normal and tangent of the current vertex are updated based on the rotation, thus obtaining the target vertex data after deformation.

[0046] In another approach, the local coordinate system of the current vertex is determined based on the initial vertex data, which includes the normal, tangent, and bitangent of the current vertex. The displacement vector and rotation quaternion of the current vertex are determined based on the position data of the first and second position points. The position coordinates of the current vertex are updated based on the displacement vector, and the local coordinate system is updated based on the rotation quaternion of the current vertex, thus obtaining the target vertex data after deformation.

[0047] Specifically, the displacement vector of the current vertex can be obtained by calculating the difference between the position coordinates of the first position point and the position coordinates of the second position point. First, the position coordinates of the first position point and the position coordinates of the second position point are converted into a first vector and a second vector. Then, based on the first vector and the second vector, the rotation axis and rotation angle are calculated. Finally, the rotation quaternion is calculated based on the rotation axis and rotation angle.

[0048] After obtaining the rotation quaternion, the position coordinates of the current vertex are offset according to the displacement vector of the current vertex, and the local coordinate system is rotated according to the rotation quaternion of the current vertex to obtain the target vertex data after the current vertex has been deformed.

[0049] Step S210: The target vertex data of the virtual model is sent to the central processing unit. The central processing unit updates the initial vertex data of the virtual model based on the target vertex data to obtain the deformed virtual model, and displays the deformed virtual model on the graphical user interface.

[0050] The method further includes: determining user-inputted deformation parameters in response to a deformation command for the first line; wherein the deformation parameters are used to determine the deformation weight of the deformation command in the virtual model.

[0051] Specifically, a deformation parameter input box is provided in the graphical user interface. In response to input operations on the deformation parameter input box, the deformation parameters input by the user are determined. These deformation parameters include rotation deformation parameters, scaling deformation parameters, offset deformation parameters, and deformation intensity parameters.

[0052] Optionally, the above deformation parameters include a first deformation parameter, which typically includes rotational deformation parameters, scaling deformation parameters, and offset deformation parameters.

[0053] Before the steps of updating the position coordinates of the current vertex based on the displacement vector of the current vertex, updating the local coordinate system based on the rotation quaternion of the current vertex, and obtaining the target vertex data after deformation, the above method further includes: calculating the weight of the displacement vector of the current vertex based on the first deformation parameter to obtain the calculated displacement vector of the current vertex; and calculating the weight of the rotation quaternion of the current vertex based on the first deformation parameter to obtain the calculated rotation quaternion of the current vertex.

[0054] Specifically, the displacement vector of the current vertex is multiplied by the offset deformation parameter to obtain the target position vector of the current vertex, and the rotation quaternion of the current vertex is multiplied by the rotation deformation parameter to obtain the target quaternion of the current vertex.

[0055] Typically, the target vertex data of the current vertex is also magnified or shrunk according to the scaling deformation parameters.

[0056] The aforementioned deformation parameters include the second deformation parameter; after the step of calculating the target vertex data of the virtual model after deformation, the above method further includes: for each vertex of the virtual model, according to the second deformation parameter, performing weight calculation on the target vertex data of the current vertex and the initial vertex data of the current vertex to obtain the calculated target vertex data of the current vertex.

[0057] The weight calculation can be either a weighted average or a difference calculation.

[0058] For example, it can be calculated as follows: the initial vertex data of the current vertex * (1-a) + the target vertex data of the current vertex * a; where a is the second deformation parameter.

[0059] For example, interpolation can be performed between the target vertex data of the current vertex and the initial vertex data of the current vertex based on the second deformation parameter.

[0060] If the third deformation parameter is 0, the virtual model will not deform even if the user drags the first line. If the third deformation parameter is 1, the final calculated target vertex data will be the final target vertex data.

[0061] Corresponding to the above method embodiments, this disclosure provides a deformation device for a virtual model, which provides a graphical user interface through a terminal device. The graphical user interface displays a virtual model, and the virtual model corresponds to a first line; for example... Figure 3 As shown, the device includes: The spline determination module 301 is used to determine the deformed second spline in response to the deformation command for the first spline; The data sending module 302 is used to send the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor. The data calculation module 303 is used to calculate the target vertex data of the virtual model after deformation by using the shader running in the graphics processor, based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model. The data update module 304 is used to send the target vertex data of the virtual model to the central processing unit. The central processing unit updates the initial vertex data of the virtual model based on the target vertex data to obtain the deformed virtual model, and displays the deformed virtual model on the graphical user interface.

[0062] This disclosure provides a virtual model deformation device. In response to a deformation command for a first spline, it determines a second spline after deformation. Control point data of the first and second splines, along with initial vertex data of the virtual model, are sent to a graphics processor (GPU). A shader running on the GPU calculates target vertex data of the deformed virtual model based on the control point data of the first and second splines and the initial vertex data of the virtual model. The target vertex data is then sent to a central processing unit (CPU). The CPU updates the initial vertex data of the virtual model based on the target vertex data, resulting in the deformed virtual model, which is then displayed on a graphical user interface. This method utilizes a shader running on the GPU to process vertex transformation calculations, performing simple and repetitive vertex transformation calculations in parallel on the GPU. The CPU updates the initial vertex data based on the calculation results, avoiding frequent array creation and deletion, thereby reducing resource and computational performance waste.

[0063] The initial vertex data mentioned above includes the mapping value corresponding to each vertex, which is used to determine the position point in the first line that affects the vertex; the mapping value corresponding to each vertex is determined in the following way: ;in, The mapping value of the vertex. The coordinate values ​​of the specified coordinate axis for the vertex. The minimum value among the coordinates of all vertices of the virtual model on a specified axis. The difference between the maximum and minimum coordinate values ​​of all vertices of the virtual model on a specified axis.

[0064] The aforementioned data calculation module is also used to: for each vertex in the virtual model, based on the mapping value corresponding to the current vertex, determine the position data of the first position point affecting the current vertex from the first spline, and determine the position data of the second position point affecting the current vertex from the second spline; and determine the target vertex data after deformation of the current vertex based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex.

[0065] The aforementioned data calculation module is also used to: determine the local coordinate system of the current vertex based on the initial vertex data of the current vertex, which includes the normal, tangent, and bitangent of the current vertex; determine the displacement vector and rotation quaternion of the current vertex based on the position data of the first position point and the position data of the second position point; update the position coordinates of the current vertex based on the displacement vector of the current vertex, update the local coordinate system based on the rotation quaternion of the current vertex, and obtain the target vertex data after the current vertex has been deformed.

[0066] The aforementioned data transmission module is also used to: send the control point data of the first spline to the first buffer of the graphics processor; send the control point data of the second spline to the second buffer of the graphics processor; and send the initial vertex data of the virtual model to the third buffer of the graphics processor.

[0067] The aforementioned device further includes a parameter determination module, used to: determine user-input deformation parameters in response to a deformation command for the first line; wherein the deformation parameters are used to determine the deformation weight of the deformation command in the virtual model.

[0068] The aforementioned deformation parameters include a first deformation parameter; the aforementioned data calculation module is also used to: calculate the weight of the displacement vector of the current vertex according to the first deformation parameter, and obtain the calculated displacement vector of the current vertex; calculate the weight of the rotation quaternion of the current vertex according to the first deformation parameter, and obtain the calculated rotation quaternion of the current vertex.

[0069] The aforementioned deformation parameters include the second deformation parameter; the aforementioned data calculation module is also used to: for each vertex of the virtual model, calculate the weights of the target vertex data and the initial vertex data of the current vertex according to the second deformation parameter, and obtain the calculated target vertex data of the current vertex.

[0070] The deformation device for the virtual model provided in this embodiment has the same technical features as the deformation method for the virtual model provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.

[0071] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the deformation method of the virtual model described above. This electronic device can be a server or a terminal device.

[0072] See Figure 4 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the deformation method of the virtual model described above.

[0073] Furthermore, Figure 4 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0074] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0075] The processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0076] The processor in the aforementioned electronic device, by executing machine-executable instructions, can implement the following operations in the deformation method of the aforementioned virtual model: In response to the deformation instruction for the first spline, the deformed second spline is determined. The control point data of the first and second splines, along with the initial vertex data of the virtual model, are sent to the graphics processing unit (GPU). Using shaders running on the GPU, the target vertex data of the deformed virtual model is calculated based on the control point data of the first and second splines and the initial vertex data of the virtual model. This target vertex data is then sent to the central processing unit (CPU). The CPU updates the initial vertex data of the virtual model based on the target vertex data, resulting in the deformed virtual model, which is then displayed on the graphical user interface. This method utilizes shaders running on the GPU to handle vertex transformation calculations, performing simple and repetitive vertex transformation calculations in parallel on the GPU. The CPU updates the initial vertex data based on the calculation results, avoiding frequent array creation and deletion, thus reducing resource and computational waste.

[0077] The initial vertex data mentioned above includes the mapping values ​​corresponding to the vertices. These mapping values ​​are used to determine the positions of the vertices in the first line. The mapping values ​​corresponding to the vertices are determined in the following way: ;in, The mapping value of the vertex. The coordinate values ​​of the specified coordinate axis for the vertex. The minimum value among the coordinates of all vertices of the virtual model on a specified axis. The difference between the maximum and minimum coordinate values ​​of all vertices of the virtual model on a specified axis.

[0078] The steps for calculating the target vertex data after deformation of the virtual model based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model include: for each vertex in the virtual model, based on the mapping value corresponding to the current vertex, determining the position data of the first position point affecting the current vertex from the first spline, and determining the position data of the second position point affecting the current vertex from the second spline; and determining the target vertex data after deformation of the current vertex based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex.

[0079] The steps described above for determining the target vertex data after deformation of the current vertex based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex include: determining the local coordinate system of the current vertex based on the initial vertex data of the current vertex, which includes the normal, tangent, and bitangent of the current vertex; determining the displacement vector and rotation quaternion of the current vertex based on the position data of the first and second position points; updating the position coordinates of the current vertex based on the displacement vector of the current vertex; updating the local coordinate system based on the rotation quaternion of the current vertex; and obtaining the target vertex data after deformation of the current vertex.

[0080] The steps described above for sending the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor include: sending the control point data of the first spline to the first buffer of the graphics processor; sending the control point data of the second spline to the second buffer of the graphics processor; and sending the initial vertex data of the virtual model to the third buffer of the graphics processor.

[0081] The method further includes: determining user-inputted deformation parameters in response to a deformation command for the first line; wherein the deformation parameters are used to determine the deformation weight of the deformation command in the virtual model.

[0082] The aforementioned deformation parameters include a first deformation parameter. Before the steps of updating the position coordinates of the current vertex based on the displacement vector of the current vertex, updating the local coordinate system based on the rotation quaternion of the current vertex, and obtaining the target vertex data after deformation, the above method further includes: calculating the weight of the displacement vector of the current vertex based on the first deformation parameter to obtain the calculated displacement vector of the current vertex; and calculating the weight of the rotation quaternion of the current vertex based on the first deformation parameter to obtain the calculated rotation quaternion of the current vertex.

[0083] The aforementioned deformation parameters include the second deformation parameter; after the step of calculating the target vertex data of the virtual model after deformation, the method further includes: for each vertex of the virtual model, according to the second deformation parameter, performing weight calculation on the target vertex data of the current vertex and the initial vertex data of the current vertex to obtain the calculated target vertex data of the current vertex.

[0084] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the deformation method of the virtual model described above.

[0085] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be used to perform the following operations in the deformation method of the aforementioned virtual model by executing these machine-executable instructions: In response to the deformation instruction for the first spline, the deformed second spline is determined. The control point data of the first and second splines, along with the initial vertex data of the virtual model, are sent to the graphics processing unit (GPU). Using shaders running on the GPU, the target vertex data of the deformed virtual model is calculated based on the control point data of the first and second splines and the initial vertex data of the virtual model. This target vertex data is then sent to the central processing unit (CPU). The CPU updates the initial vertex data of the virtual model based on the target vertex data, resulting in the deformed virtual model, which is then displayed on the graphical user interface. This method utilizes shaders running on the GPU to handle vertex transformation calculations, performing simple and repetitive vertex transformation calculations in parallel on the GPU. The CPU updates the initial vertex data based on the calculation results, avoiding frequent array creation and deletion, thus reducing resource and computational waste.

[0086] The initial vertex data mentioned above includes the mapping values ​​corresponding to the vertices. These mapping values ​​are used to determine the positions of the vertices in the first line. The mapping values ​​corresponding to the vertices are determined in the following way: ;in, The mapping value of the vertex. The coordinate values ​​of the specified coordinate axis for the vertex. The minimum value among the coordinates of all vertices of the virtual model on a specified axis. The difference between the maximum and minimum coordinate values ​​of all vertices of the virtual model on a specified axis.

[0087] The steps for calculating the target vertex data after deformation of the virtual model based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model include: for each vertex in the virtual model, based on the mapping value corresponding to the current vertex, determining the position data of the first position point affecting the current vertex from the first spline, and determining the position data of the second position point affecting the current vertex from the second spline; and determining the target vertex data after deformation of the current vertex based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex.

[0088] The steps described above for determining the target vertex data after deformation of the current vertex based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex include: determining the local coordinate system of the current vertex based on the initial vertex data of the current vertex, which includes the normal, tangent, and bitangent of the current vertex; determining the displacement vector and rotation quaternion of the current vertex based on the position data of the first and second position points; updating the position coordinates of the current vertex based on the displacement vector of the current vertex; updating the local coordinate system based on the rotation quaternion of the current vertex; and obtaining the target vertex data after deformation of the current vertex.

[0089] The steps described above for sending the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor include: sending the control point data of the first spline to the first buffer of the graphics processor; sending the control point data of the second spline to the second buffer of the graphics processor; and sending the initial vertex data of the virtual model to the third buffer of the graphics processor.

[0090] The method further includes: determining user-inputted deformation parameters in response to a deformation command for the first line; wherein the deformation parameters are used to determine the deformation weight of the deformation command in the virtual model.

[0091] The aforementioned deformation parameters include a first deformation parameter. Before the steps of updating the position coordinates of the current vertex based on the displacement vector of the current vertex, updating the local coordinate system based on the rotation quaternion of the current vertex, and obtaining the target vertex data after deformation, the method further includes: calculating the weight of the displacement vector of the current vertex based on the first deformation parameter to obtain the calculated displacement vector of the current vertex; and calculating the weight of the rotation quaternion of the current vertex based on the first deformation parameter to obtain the calculated rotation quaternion of the current vertex.

[0092] The aforementioned deformation parameters include the second deformation parameter; after the step of calculating the target vertex data of the virtual model after deformation, the method further includes: for each vertex of the virtual model, according to the second deformation parameter, performing weight calculation on the target vertex data of the current vertex and the initial vertex data of the current vertex to obtain the calculated target vertex data of the current vertex.

[0093] The computer program products of the virtual model deformation method, apparatus, electronic device and system provided in the embodiments of this disclosure include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0095] Furthermore, in the description of the embodiments of this disclosure, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this disclosure based on the specific circumstances.

[0096] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0097] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0098] Finally, it should be noted that the above embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A deformation method for a virtual model, characterized in that, A graphical user interface is provided through a terminal device, the graphical user interface displays a virtual model, and the virtual model corresponds to a first line; the method includes: In response to the deformation command for the first spline, the deformed second spline is determined; The control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model are sent to the graphics processor. By running a shader in the graphics processor, the target vertex data of the virtual model after deformation is calculated based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model. The target vertex data of the virtual model is sent to the central processing unit. The central processing unit updates the initial vertex data of the virtual model based on the target vertex data to obtain the deformed virtual model, and displays the deformed virtual model on the graphical user interface.

2. The method according to claim 1, characterized in that, The initial vertex data includes the mapping value corresponding to the vertex, and the mapping value is used to determine the position point in the first spline that affects the vertex; The mapping value corresponding to the vertex is determined in the following way: ; in, The mapping value of the vertex. The coordinates of the specified coordinate axis of the vertex. It is the minimum value among the coordinates of all vertices of the virtual model along the specified coordinate axis. It is the difference between the maximum value of the coordinates of all vertices of the virtual model on the specified coordinate axis and the minimum value of the coordinates of all vertices of the virtual model on the specified coordinate axis.

3. The method according to claim 2, characterized in that, The step of calculating the target vertex data of the deformed virtual model based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model includes: For each vertex in the virtual model, based on the mapping value corresponding to the current vertex, the position data of the first position point affecting the current vertex is determined from the first spline, and the position data of the second position point affecting the current vertex is determined from the second spline; Based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex, the target vertex data after deformation of the current vertex is determined.

4. The method according to claim 3, characterized in that, The step of determining the target vertex data after deformation of the current vertex based on the position data of the first position point, the position data of the second position point, and the initial vertex data of the current vertex includes: The local coordinate system of the current vertex is determined based on the initial vertex data of the current vertex, which includes the normal, tangent and bitangent of the current vertex. Based on the position data of the first position point and the position data of the second position point, determine the displacement vector of the current vertex and the rotation quaternion of the current vertex; The position coordinates of the current vertex are updated based on the displacement vector of the current vertex, and the local coordinate system is updated based on the rotation quaternion of the current vertex to obtain the target vertex data after deformation of the current vertex.

5. The method according to claim 1, characterized in that, The step of sending the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor includes: Send the control point data of the first spline to the first buffer of the graphics processor; The control point data of the second spline is sent to the second buffer of the graphics processor; The initial vertex data of the virtual model is sent to the third buffer of the graphics processor.

6. The method according to claim 4, characterized in that, The method further includes: In response to a deformation command for the first spline, a deformation parameter input by the user is determined; wherein the deformation parameter is used to determine the deformation weight of the deformation command in the virtual model.

7. The method according to claim 6, characterized in that, The deformation parameters include a first deformation parameter; Before the steps of updating the position coordinates of the current vertex based on the displacement vector of the current vertex, updating the local coordinate system based on the rotation quaternion of the current vertex, and obtaining the target vertex data after deformation of the current vertex, the method further includes: Based on the first deformation parameter, the displacement vector of the current vertex is weighted and calculated to obtain the calculated displacement vector of the current vertex; Based on the first deformation parameter, the rotation quaternion of the current vertex is weighted and calculated to obtain the calculated rotation quaternion of the current vertex.

8. The method according to claim 6, characterized in that, The deformation parameters include a second deformation parameter; after the step of calculating the target vertex data of the virtual model after deformation, the method further includes: For each vertex of the virtual model, weights are calculated on the target vertex data and the initial vertex data of the current vertex according to the second deformation parameter to obtain the calculated target vertex data of the current vertex.

9. A deformation device for a virtual model, characterized in that, A graphical user interface is provided via a terminal device, the graphical user interface displaying a virtual model, the virtual model corresponding to a first line; the device includes: A spline determination module is used to determine a second spline after deformation in response to a deformation command for the first spline; The data transmission module is used to send the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model to the graphics processor. The data calculation module is used to calculate the target vertex data of the virtual model after deformation by using a shader running in the graphics processor, based on the control point data of the first spline, the control point data of the second spline, and the initial vertex data of the virtual model. The data update module is used to send the target vertex data of the virtual model to the central processing unit, and through the central processing unit, update the initial vertex data of the virtual model based on the target vertex data to obtain the deformed virtual model, and display the deformed virtual model on the graphical user interface.

10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the deformation method of the virtual model according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the deformation method of the virtual model according to any one of claims 1-8.