Model scaling method and device
By determining the hierarchical relationship and controller status of the bone nodes and calculating the scaling parameters, the error and efficiency problems in the scaling process of the bone model are solved, and the accuracy of bone position and scaling efficiency are improved.
Patent Information
- Application Number
- CN202210704449.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-06-21
AI Technical Summary
The prior art has problems such as large manual errors, low efficiency and inability to obtain ideal scaling results during model scaling. Especially when the bone model is scaled, it is easy to cause some bones to deform or detach from the model.
By determining the hierarchical relationship of the bone node, distinguishing the target bone node and other bone nodes, calculating the scaling parameters, and scaling the model from top to bottom according to the hierarchical relationship to avoid bone position offset.
The relative position accuracy of the bones and models after model scaling is achieved, the efficiency of making game action files is improved, manual errors and repeated corrections are avoided, and R&D efficiency is improved.
Smart Images

Figure CN115063515B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of model scaling, and in particular to a model scaling method, a model scaling device, an electronic device, and a computer-readable storage medium. Background Art
[0002] Modern 3D games use a vast array of character models, animation models, and animation resources. Skeleton models are the most widely used 3D models. Skeleton models and their associated animations account for a significant portion of the corresponding character art resources in games.
[0003] Currently, scaling skeletal models is typically done manually or through automated adjustments using plugins within animation rendering and production software. Manual adjustments often introduce errors during the scaling process, requiring repeated corrections, increasing R&D costs and reducing efficiency. Automatic adjustments using plugins within animation rendering and production software, however, lack a robust scaling mechanism, making ideal scaling results unattainable and resulting in inefficient scaling. Summary of the Invention
[0004] The embodiment of the present invention provides a model scaling method, device, electronic device and computer-readable storage medium to solve the problem of bone deformation and separation from the model during model scaling.
[0005] An embodiment of the present invention discloses a model scaling method, which may include:
[0006] Determine a target model; the target model includes a plurality of first skeletal nodes;
[0007] Determining a first hierarchical relationship between a plurality of the first skeletal nodes;
[0008] Determine a target first skeletal node from a plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node; the target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for the other first skeletal nodes; the target first skeletal node includes a first root skeletal node and a first child skeletal node, and the other first skeletal nodes include a second root skeletal node and a second child skeletal node;
[0009] Calculate scaling parameters for the plurality of skeletal nodes based on the first root skeletal node, the first child skeletal node, the second root skeletal node, and the second child skeletal node;
[0010] Based on the first hierarchical relationship, the target model is scaled according to the scaling parameter.
[0011] Optionally, the step of determining the target model may include:
[0012] Traversing the second skeletal nodes and determining a second hierarchical relationship between a plurality of the second skeletal nodes;
[0013] Based on the second hierarchical relationship, determining a third child skeletal node from the plurality of second skeletal nodes;
[0014] Determine a target second skeletal node from the plurality of second skeletal nodes; the target second skeletal node includes a third skeletal node;
[0015] When the parent skeletal node corresponding to the third child skeletal node has other child skeletal nodes, determining a target third root skeletal node corresponding to the parent skeletal node from the third root skeletal nodes;
[0016] When the other child skeleton nodes have no association relationship with the target third root skeleton node, the other child skeleton nodes are added to the target third root skeleton node;
[0017] The third root skeleton node and the child skeleton nodes associated with the third root skeleton node are taken as a target model.
[0018] Optionally, the other first bone nodes have corresponding other bones, the first root bone node has corresponding root special bone node coordinates, the first child bone node has corresponding first child bone node coordinates, the second root bone node has corresponding second root bone node coordinates, and the second child bone node has corresponding second child bone node coordinates. The step of calculating scaling parameters for the plurality of bone nodes based on the first root bone node, the first child bone node, the second root bone node, and the second child bone node may include:
[0019] Calculate a first offset for the first root bone node and the first child bone node using the coordinates of the root special bone node and the coordinates of the first child bone node;
[0020] Calculating a second offset of the first root bone node and the first child bone node after scaling using the first offset and a preset scaling ratio;
[0021] Calculating first target position coordinates for the target first bone node using the second offset and the first child bone node coordinates;
[0022] Calculating the initial length attribute value of the other bones using the coordinates of the second root bone node and the coordinates of the second child bone node;
[0023] Calculating target length attribute values for the other bones using the initial length attribute value and a preset scaling ratio;
[0024] Calculating the second target position coordinates for the other first skeletal nodes using the target length attribute value and the coordinates of the second child skeletal node;
[0025] The first target position coordinates and the second target position coordinates are used as scaling parameters.
[0026] Optionally, after the step of determining the target model, the following steps may also be included:
[0027] When a constraint relationship exists between the first skeletal nodes, the constraint relationship is released.
[0028] Optionally, the constraint relationship includes a constraint type and a link relationship. After scaling the target model according to the scaling parameter based on the first hierarchical relationship, the method may further include:
[0029] Based on the first hierarchical relationship, in accordance with a preset order, the target first skeletal node that deviates from the first target position coordinate is placed on the first target position coordinate, and the other first skeletal nodes that deviate from the second target position coordinate are placed on the second target position coordinate;
[0030] When the length attribute value of the other bone is different from the target length attribute value, adopting the target length attribute value as the length attribute value of the other bone;
[0031] The constraint type and the link relationship are used to restore the constraint relationship for the plurality of first skeletal nodes.
[0032] Optionally, after the step of determining a target first skeletal node from the plurality of first skeletal nodes and other first skeletal nodes in the target model except the target first skeletal node, the method may further include:
[0033] The target first skeletal node is arranged using the first hierarchical relationship, and when a special skeletal node constraint relationship exists for the target first skeletal node, the special skeletal node constraint relationship is released.
[0034] Optionally, the method may further include:
[0035] A non-scalable bone node is determined from the plurality of first bone nodes, and the non-scalable bone node is modified into a scalable bone node.
[0036] The embodiment of the present invention further discloses a model scaling device, which may include:
[0037] A target model determination module is used to determine a target model; the target model includes a plurality of first skeletal nodes;
[0038] A first hierarchical relationship determining module, configured to determine a first hierarchical relationship between a plurality of said first skeletal nodes;
[0039] A special skeletal node distinguishing module is used to determine a target first skeletal node from a plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node; the target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for the other first skeletal nodes; the target first skeletal node includes a first root skeletal node and a first child skeletal node, and the other first skeletal nodes include a second root skeletal node and a second child skeletal node;
[0040] A scaling parameter calculation module, configured to calculate scaling parameters for a plurality of skeletal nodes based on the first root skeletal node, the first child skeletal node, the second root skeletal node, and the second child skeletal node;
[0041] A model scaling module is configured to scale the target model according to the scaling parameter based on the first hierarchical relationship.
[0042] Optionally, the target model determination module may include:
[0043] a second hierarchical relationship determination submodule, configured to traverse the second skeletal nodes and determine a second hierarchical relationship between a plurality of the second skeletal nodes;
[0044] The sub-skeletal node enterprise does not dare to sub-module, for determining a third sub-skeletal node from a plurality of the second skeletal nodes based on the second hierarchical relationship;
[0045] A target second skeletal node determination submodule is configured to determine a target second skeletal node from a plurality of the second skeletal nodes; the target second skeletal node includes a third skeletal node;
[0046] A third skeletal node determination submodule is configured to determine a target third skeletal node corresponding to the parent skeletal node from the third skeletal node when the parent skeletal node corresponding to the third child skeletal node has other child skeletal nodes;
[0047] A child skeleton node adding submodule, configured to add the other child skeleton nodes to the target third skeleton node when the other child skeleton nodes have no association relationship with the target third skeleton node;
[0048] The target model determination submodule is used to take the third root skeleton node and the child skeleton nodes associated with the third root skeleton node as a target model.
[0049] Optionally, the device may further include:
[0050] The constraint relationship releasing module is used to release the constraint relationship when a constraint relationship exists on the first skeletal node.
[0051] Optionally, the other first bone nodes have corresponding other bones, the first root bone node has corresponding root special bone node coordinates, the first child bone node has corresponding first child bone node coordinates, the second root bone node has corresponding second root bone node coordinates, the second child bone node has corresponding second child bone node coordinates, and the scaling parameter calculation module may include:
[0052] A first offset calculation submodule, configured to calculate a first offset for the first root skeletal node and the first child skeletal node using the coordinates of the root special skeletal node and the coordinates of the first child skeletal node;
[0053] A second offset calculation submodule, configured to calculate a second offset of the first root skeleton node and the first child skeleton node after scaling by using the first offset and a preset scaling ratio;
[0054] A first target position coordinate calculation submodule, configured to calculate a first target position coordinate for the target first skeletal node using the second offset and the first child skeletal node coordinates;
[0055] A third offset calculation submodule, configured to calculate initial length attribute values for the other bones using the coordinates of the second root bone node and the coordinates of the second child bone node;
[0056] a fourth offset calculation submodule, configured to calculate target length attribute values for the other bones using the initial length attribute value and a preset scaling ratio;
[0057] A second target position coordinate calculation submodule, configured to calculate the second target position coordinates for the other first skeletal nodes using the target length attribute value and the coordinates of the second child skeletal node;
[0058] The scaling parameter determination submodule is configured to use the first target position coordinates and the second target position coordinates as scaling parameters.
[0059] Optionally, the constraint relationship includes a constraint type and a link relationship, and the apparatus may further include:
[0060] a skeletal node correction module, configured to, based on the first hierarchical relationship and in a preset order, place the target first skeletal node that deviates from the first target position coordinates at the first target position coordinates, and place the other first skeletal nodes that deviate from the second target position coordinates at the second target position coordinates;
[0061] a length attribute value replacement module, configured to adopt the target length attribute value as the length attribute value of the other bone when the length attribute value of the other bone is different from the target length attribute value;
[0062] A constraint relationship recovery module is used to use the constraint type and the link relationship to recover the constraint relationship for multiple first skeletal nodes.
[0063] Optionally, the device may further include:
[0064] The special bone node constraint relationship releasing module is used to arrange the target first bone node using the first hierarchical relationship, and when a special bone node constraint relationship exists for the target first bone node, release the special bone node constraint relationship.
[0065] Optionally, the device may further include:
[0066] The scalable bone node modification module is used to determine a non-scalable bone node from the plurality of first bone nodes, and modify the non-scalable bone node into a scalable bone node.
[0067] An embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0068] The memory is used to store computer programs;
[0069] The processor is configured to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0070] An embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon. When executed by one or more processors, the processors are enabled to execute the method according to the embodiment of the present invention.
[0071] The embodiments of the present invention include the following advantages:
[0072] An embodiment of the present invention pre-processes the skeleton nodes in the model before scaling the model, specifically including determining the first hierarchical relationship for the first skeleton node, distinguishing the target first skeleton node from other first skeleton nodes, and calculating scaling parameters for multiple skeleton nodes based on the first root skeleton node, the first child skeleton node, the second root skeleton node, and the second child skeleton node. When the target first skeleton node controller is in the on state, the target model is scaled from top to bottom according to the scaling parameters based on the first hierarchical relationship, thereby avoiding demolding caused by the relative position offset of some bones and the model after scaling, thereby improving the model automatic scaling mechanism and further improving the efficiency of making game action files. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 This is a schematic diagram of the changes in the model skeleton before and after scaling in the prior art;
[0074] Figure 2 This is another schematic diagram of the changes in the model skeleton before and after scaling in the prior art;
[0075] Figure 3 This is another schematic diagram of the changes in the model skeleton before and after scaling in the prior art;
[0076] Figure 4 is a flowchart of the steps of a model scaling method provided in an embodiment of the present invention;
[0077] Figure 5 1 is a schematic diagram comparing a Biped-type node controller for Biped-type nodes and a controller for non-Biped-type nodes provided by an embodiment of the present invention;
[0078] Figure 6 is a schematic diagram of a second skeleton hierarchical relationship provided by an embodiment of the present invention;
[0079] Figure 7 is a structural block diagram of a model scaling device provided in an embodiment of the present invention;
[0080] Figure 8 This is a hardware structure block diagram of an electronic device provided in each embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0082] In order to enable those skilled in the art to better understand the embodiments of the present invention, the technical terms involved in the embodiments of the present invention are explained below.
[0083] 3D Studio Max: 3D Studio Max, abbreviated as 3D Max, is a 3D animation rendering and production software developed by Discreet based on computer systems.
[0084] Bone skeleton: Bone skeleton is a common model bone type in 3D Max. Its bone nodes are not special bone nodes, and its bone node controllers are not special bone node controllers.
[0085] Biped skeleton: Biped skeleton is a type of biped skeleton in 3D Max. It can also be understood as a hierarchical skeleton system that includes constraints such as IK / FK. It belongs to a special skeleton node and has corresponding special skeleton nodes. Special skeleton nodes can be used to generate constraints on special skeleton nodes.
[0086] IK / FK: IK (Inverse Kinematics) refers to a process used in 3D computer graphics animation. In this process, the parameters of each node in a connected object (a kinematic chain) are automatically calculated to achieve the desired position. Essentially, IK describes how the displacement and rotation of a parent node are affected when a child skeletal node moves. FK (Forward Kinematics) refers to the displacement and rotation of a joint within a model at a specified time. In other words, FK refers to how the movement or rotation of a parent skeletal node affects the child skeletal nodes.
[0087] Figure Mode: Figure mode is a mode in 3D Max with special controllers turned on. Figure mode can change the structure of the biped and make its structure fit the character mesh. It can also be used to adjust the biped after the mesh is attached to the correct biped joint positions. It can also be used to adjust the biped after the mesh is attached to the correct pose in the motion file, define the biped structure, and scale the model.
[0088] Bone constraints: Since bones behave like objects in body mode, they can also be constrained like objects. Bone constraints can be used to limit the degrees of freedom in posture transformations. For example, a person's elbow cannot rotate backward unless the arm is broken, nor can it rotate sideways. The forward rotation and rotation of the elbow are limited to a given range, which is a limit constraint.
[0089] Controller: The purpose of the controller is to display the "link" constraint key points in the track bar, and these key points can be manipulated here. Special bone nodes have corresponding special controllers. For example, in 3D Max, there is a dedicated special controller for the Biped bone node, which is different from the controller for the Bone bone node.
[0090] In practical applications, when creating game action files, it is usually necessary to determine the model's proportions in advance, build the skeleton based on the model, perform skinning, and then create keyframe animations to achieve the action effects. However, in practice, in order to shorten the R&D cycle, developers often cannot follow a production pipeline that first creates the model, then builds the skeleton and skins it, and finally creates keyframe animations. Model production and action production often need to start simultaneously, which can easily lead to proportional errors between the final model and the model actually used to create the skeleton animation. To avoid reproducing complex keyframe animations, manual adjustment of the model's proportions is usually adopted. That is, the model is scaled to resolve the error problem. However, during the process of adjusting the model's proportions, developers often need to perform tasks such as re-building the skeleton, re-skinning, and manually importing animations. This requires a huge amount of work for developers, resulting in a huge labor cost for adjusting the model's proportions. Moreover, performing model proportion adjustment requires a certain technical threshold, which further increases the labor cost. Manually adjusting the model scale requires a huge manpower cost, and manual errors often occur during the scaling process, resulting in the need for repeated corrections during the scaling process, which not only further increases R&D costs but also reduces R&D efficiency. Therefore, related technologies also hope to use the system to automatically adjust the model scale to achieve model scaling. However, since related technologies have not improved the model scaling mechanism, ideal scaling results cannot be obtained. In order to enable technical personnel in this field to understand the technical solutions of related technologies in more detail, four examples are used below to illustrate.
[0091] For example, in 3D Studio Max, the software's built-in scaling function only considers the width and height of the bone, but not the length. As a result, the bone may be deformed after the model is scaled. Figure 1 , Figure 1 This is a schematic diagram of the changes in the model skeleton before and after scaling in the prior art. A bone node is at relative position 101 before scaling. Since the system does not consider scaling the length of the bone, the bone node appears at relative position 102 after scaling. That is, the relative position of the same bone node to the model body is displaced after scaling, resulting in bone deformation.
[0092] In the second example, during the scaling process, the model nodes that were previously bound to the skeleton may be offset because the skeleton and model scaling ratios do not match, or the biped skeleton is not scaled in figure mode. Figure 2 , Figure 2 This is another schematic diagram of the changes in the model skeleton before and after scaling in the prior art. The model node 201 is connected to the character model before scaling, but after scaling, the model node 202 is separated from the character model.
[0093] Example 3: During the scaling process, for bones bound by position constraints or hierarchical constraints, such as a parent bone used to constrain a child bone, the displacement / size of the parent bone often affects the displacement / size of the child bone. Therefore, the position and size of the bones with constrained relationships will be offset after scaling. For example, the parent bone is A, the child bone is B, A constrains B, and B is constrained by A. If A is reduced by 0.5 times, it is expected that B should also be reduced by 0.5 times. However, the existing plug-in ignores the hierarchical relationship and reduces all bones, resulting in B actually only being reduced by 0.25 times, which is inconsistent with the expected target.
[0094] Example 4: During the scaling process, since the relevant technology does not scale the bones in figure mode, it is impossible to ensure that the binding is correct when binding the biped bones, resulting in the displacement of some bones in the pure biped bones and the model containing biped bones after scaling. Figure 3 , Figure 3 This is another schematic diagram of the changes in the model bones before and after scaling in the prior art. A bone is at position 301 before scaling. Since the system does not scale the bone in body shape mode, the bone appears at position 302 after scaling.
[0095] Reference Figure 4 , shows a flowchart of the steps of a model scaling method provided in an embodiment of the present invention, which may specifically include the following steps:
[0096] Step 401, determining a target model; the target model includes a plurality of first skeletal nodes;
[0097] Step 402: determining a first hierarchical relationship between a plurality of the first skeletal nodes;
[0098] Step 403: Determine a target first skeletal node from the plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node; the target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for the other first skeletal nodes; the target first skeletal node includes a first root skeletal node and a first child skeletal node, and the other first skeletal nodes include a second root skeletal node and a second child skeletal node;
[0099] Step 404: Calculate scaling parameters for the plurality of skeletal nodes based on the first root skeletal node, the first child skeletal node, the second root skeletal node, and the second child skeletal node.
[0100] Step 405: Scale the target model according to the scaling parameter based on the first hierarchical relationship.
[0101] In a specific implementation, the embodiments of the present invention can be applied to a system for model scaling, for example, 3D Max three-dimensional animation rendering and production software. The model scaling system can have a user interface for displaying the model, and one or more target models can exist in the user interface. The target model can be an independent model that does not share bone nodes with other models.
[0102] The embodiment of the present invention can determine a target model in a scene, and the target model can include multiple first skeleton nodes.
[0103] In actual applications, skeleton nodes will have corresponding levels, and there will be a hierarchical relationship between multiple skeleton nodes. For example, node A is a second-level node, and node B is a third-level node. Node A can be called a parent node, and node B can be called a child skeleton node. The embodiment of the present invention can traverse all nodes in the target model through the breadth-first algorithm BFS to determine the first-level relationship between multiple first skeleton nodes. Because the BFS algorithm can naturally traverse hierarchically, the efficiency of determining the first-level relationship can be improved. Of course, those skilled in the art can adopt other algorithms, such as the depth-first algorithm DFS to traverse all nodes in the target model. This is also feasible, and the embodiment of the present invention does not limit this.
[0104] The target first skeletal node of the embodiment of the present invention is different from other first skeletal nodes. For example, in 3DMax, Biped type nodes are different from non-Biped type nodes because the target first skeletal node has a corresponding target first skeletal node controller, which is different from the controller of ordinary skeletal nodes. For example, Biped type nodes have corresponding Biped type node controllers, and non-Biped type nodes have controllers for non-Biped type nodes. Therefore, if the target first skeletal node is not scaled separately, the target model containing the target first skeletal node will have some bone positions offset after scaling. Therefore, it is necessary to classify the target first skeletal node and other first skeletal nodes. Therefore, after determining the first hierarchical relationship, the embodiment of the present invention can determine the target first skeletal node from multiple first skeletal nodes, as well as other first skeletal nodes in the target model except the target first skeletal node. The target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for other first skeletal nodes.
[0105] For example, in 3D Max, all Biped nodes can be identified in the first bone node of the target model, and the rest can be non-Biped nodes, such as the bone node Bone, the rescue bone node helper, the editable mesh bone node Editable_mesh, etc. Biped nodes have corresponding Biped node controllers, and non-Biped nodes have controllers for non-Biped nodes. Figure 5 , Figure 5 1 is a schematic diagram comparing a Biped type node controller for Biped type nodes and a controller for non-Biped type nodes provided by an embodiment of the present invention. Controller 501 is a Biped type node controller for Biped type nodes, and controller 502 is a controller for non-Biped type nodes.
[0106] The target first skeletal node of the embodiment of the present invention includes a first root skeletal node and a first child skeletal node, while other first skeletal nodes may include a second root skeletal node and a second child skeletal node, that is, the first root skeletal node and the first child skeletal node may be the root node and the child node of the target first skeletal node, respectively, and the second root skeletal node and the second child skeletal node may be the root node and the child node of other first skeletal nodes, respectively. For example, after classifying the Biped and non-Biped skeletal nodes, the child skeletal nodes and the root skeletal nodes on the Biped skeleton may be determined from multiple first skeletal nodes through the first hierarchical relationship. The Biped root skeletal node may be a node in the Biped node having a corresponding target first skeletal node controller. Similarly, the child skeletal nodes and the root skeletal nodes on the non-Biped skeleton may be determined from multiple first skeletal nodes through the first hierarchical relationship. The non-Biped root skeletal node may be a node in the non-Biped node having a corresponding controller.
[0107] As can be seen from the above, if the model is scaled when the target first skeletal node controller is turned off, the special bones corresponding to the special skeletal nodes, as well as the model containing the special skeletal nodes, will be offset in the position of some bones after scaling. Moreover, since the hierarchy of the bones will also constrain the position of the bones, the change in the position of the parent skeletal node will drive the change in the position of the child skeletal node. If the model is scaled directly as a whole, it will often cause some bones to detach from the model. In addition, since the scale change of the parent node will also affect the scale change of the child skeletal node, directly scaling the model as a whole will often cause some bones of the scaled model to be deformed. After completing the above steps, the embodiment of the present invention can calculate the scaling parameters for multiple skeletal nodes based on the first skeletal node, the first child skeletal node, the second skeletal node, and the second child skeletal node, and when the target first skeletal node controller is in the on state, based on the first hierarchical relationship, scale the target model from top to bottom according to the scaling parameters. For example, the scaling interface provided by 3D Max can be used to scale the target model in the shape mode from layer 0, layer 1, layer 2... in the order of scaling parameters.
[0108] An embodiment of the present invention pre-processes the skeleton nodes in the model before scaling the model, specifically including determining the first hierarchical relationship for the first skeleton node, distinguishing the target first skeleton node from other first skeleton nodes, and calculating scaling parameters for multiple skeleton nodes based on the first root skeleton node, the first child skeleton node, the second root skeleton node, and the second child skeleton node. When the target first skeleton node controller is in the on state, the target model is scaled from top to bottom according to the scaling parameters based on the first hierarchical relationship, thereby avoiding demolding caused by the relative position offset of some bones and the model after scaling, thereby improving the model automatic scaling mechanism and further improving the efficiency of making game action files.
[0109] Based on the above embodiment, a modified embodiment of the above embodiment is proposed. It should be noted that, in order to simplify the description, only the differences from the above embodiment are described in the modified embodiment.
[0110] In an optional embodiment of the present invention, the step of determining the target model includes:
[0111] Traversing the second skeletal nodes and determining a second hierarchical relationship between a plurality of the second skeletal nodes;
[0112] Based on the second hierarchical relationship, determining a third child skeletal node from the plurality of second skeletal nodes;
[0113] Determine a target second skeletal node from the plurality of second skeletal nodes; the target second skeletal node includes a third skeletal node;
[0114] When the parent skeletal node corresponding to the third child skeletal node has other child skeletal nodes, determining a target third root skeletal node corresponding to the parent skeletal node from the third root skeletal nodes;
[0115] When the other child skeleton nodes have no association relationship with the target third root skeleton node, the other child skeleton nodes are added to the target third root skeleton node;
[0116] The third root skeleton node and the child skeleton nodes associated with the third root skeleton node are taken as a target model.
[0117] In actual applications, the user interface for making models may contain multiple (skeleton) models. During the scaling process of a model, scaling to part of the skeleton of other models will cause the other models to be deformed. However, the scaling mechanism of the related technology does not have a mechanism for automatically distinguishing multiple models, resulting in the inability to automatically scale the models when multiple models appear in the scene. Therefore, the embodiment of the present invention needs to determine the target model in the user interface, and then scale each independent target model separately, so as to achieve the effect of scaling all target models in the scene as a whole.
[0118] Specifically, an embodiment of the present invention can use the BFS algorithm to traverse the second skeleton node and determine the second hierarchical relationship between multiple second skeleton nodes. The second skeleton node can be all the skeleton nodes in the user interface, and the second hierarchical relationship can be used to express the hierarchical relationship between multiple second skeleton nodes.
[0119] For example, reference Figure 6 , Figure 6This is a schematic diagram of the second skeleton hierarchical relationship provided by an embodiment of the present invention. The second skeleton node 601 is located at the 0th layer, the second skeleton node 602 is located at the 1st layer, and the subsequent layers are arranged in sequence.
[0120] After determining the second hierarchical relationship, an embodiment of the present invention can determine a third child skeletal node from multiple second skeletal nodes based on the second hierarchical relationship, that is, the third child skeletal node can be a child skeletal node of the second skeletal node. For example, the second skeletal node A is located in the first layer and the second skeletal node B is located in the second layer, then the second skeletal node B is the child skeletal node of the second skeletal node A, and the second skeletal node A is the parent node of the second skeletal node B.
[0121] The embodiment of the present invention can also determine the target second bone node from multiple second bone nodes. For example, after traversing all the bone nodes in the user interface, the Biped bone node can be determined from the traversed bone nodes, wherein the target second bone node can include a third bone node, that is, the third bone node can be the root bone node of the target second bone node. After determining the third bone node, it can be determined whether the parent bone node corresponding to the third child bone node has other child bone nodes. If so, the target third root bone node corresponding to the parent bone node can be determined from the third root bone node, and when the other child bone node has no association relationship with the target third root bone node, the other child bone node is added to the third root bone node, that is, when the other child bone node and the parent bone node are not associated with the same third bone node, the other child bone node is added to the same third root bone node as the parent bone node. When all the third bone nodes complete the above operations, the third bone node and the child bone node associated with the third bone node can be used as a target model.
[0122] For example, during the traversal process, it is possible to determine which skeleton nodes in the second skeleton node are Biped skeleton nodes. If it is determined that a Biped skeleton node exists, the root Biped skeleton node can be recorded as an array skeleton = #(s1, s2, ...sn). If there is no root Biped skeleton node, then skeleton = #(root), that is, the root skeleton node is the scene root skeleton node, and there is no Biped node in the scene. That is, Skeleton can be used to express the number of root Biped skeleton nodes. Assuming that it is determined that the parent bone node B corresponding to a child bone node A has a corresponding child bone node C, it is necessary to first determine which root Biped bone node the parent bone node B corresponds to. Assuming that the root Biped bone node corresponding to the parent bone node B is the root Biped bone node labeled s2, and the root Biped bone node corresponding to the child bone node C is the root Biped bone node labeled s1, the child bone node C should be added to the root Biped bone node labeled s2. Repeat the above operation until all the root Biped bone nodes are traversed. It can be considered that the skeleton contains n root Biped bone nodes, among which each root Biped bone node and the child bone node associated with it can be regarded as a target model.
[0123] In an embodiment of the present invention, second skeletal nodes are traversed and a second hierarchical relationship between a plurality of said second skeletal nodes is determined;
[0124] Based on the second hierarchical relationship, a third child skeleton node is determined from multiple second skeleton nodes; a target second skeleton node is determined from multiple second skeleton nodes; the target second skeleton node includes a third root skeleton node; when the parent skeleton node corresponding to the third child skeleton node has other child skeleton nodes, a target third root skeleton node corresponding to the parent skeleton node is determined from the third root skeleton node; when the other child skeleton nodes have no association relationship with the target third root skeleton node, the other child skeleton nodes are added to the target third root skeleton node; the third root skeleton node and the child skeleton nodes associated with the third skeleton node are used as a target model. When multiple models appear in the scene, the multiple models in the scene are automatically identified, thereby achieving overall scaling of all models in the scene.
[0125] In an optional embodiment of the present invention, the other first bone nodes have corresponding other bones, the first root bone node has corresponding root special bone node coordinates, the first child bone node has corresponding first child bone node coordinates, the second root bone node has corresponding second root bone node coordinates, and the second child bone node has corresponding second child bone node coordinates. The step of calculating the scaling parameters for the plurality of bone nodes based on the first root bone node, the first child bone node, the second root bone node, and the second child bone node includes:
[0126] Calculate a first offset for the first root bone node and the first child bone node using the coordinates of the root special bone node and the coordinates of the first child bone node;
[0127] Calculating a second offset of the first root bone node and the first child bone node after scaling using the first offset and a preset scaling ratio;
[0128] Calculating first target position coordinates for the target first bone node using the second offset and the first child bone node coordinates;
[0129] Calculating the initial length attribute value of the other bones using the coordinates of the second root bone node and the coordinates of the second child bone node;
[0130] Calculating target length attribute values for the other bones using the initial length attribute value and a preset scaling ratio;
[0131] Calculating the second target position coordinates for the other first skeletal nodes using the target length attribute value and the coordinates of the second child skeletal node;
[0132] The first target position coordinates and the second target position coordinates are used as scaling parameters.
[0133] In an embodiment of the present invention, other first bone nodes may have corresponding other bones, the first root bone node may have corresponding root special bone node coordinates, the first child bone node may have corresponding first child bone node coordinates, the second root bone node may have corresponding second root bone node coordinates, and the second child bone node may have corresponding second child bone node coordinates. In an embodiment of the present invention, the root special bone node coordinates and the first child bone node coordinates may be used to calculate the first offset for the first root bone node and the first child bone node; the first offset and a preset scaling ratio may be used to calculate the second offset for the first root bone node and the first child bone node after scaling; The first target position coordinates for the target first bone node are calculated using the second offset and the first child bone node coordinates; the initial length attribute values for other bones are calculated using the second root bone node coordinates and the second child bone node coordinates; the target length attribute values for other bones are calculated using the initial length attribute values and the preset scaling ratio; the second target position coordinates for other first bone nodes are calculated using the target length attribute values and the second child bone node coordinates; the first target position coordinates and the second target position coordinates are used as scaling parameters. Optionally, the scaling ratio of the embodiment of the present invention can be preset by the user or preset by the scaling system based on historical data.
[0134] For example, the calculation of scaling parameters mainly includes two types of parameters: one is the offset of the position of each Biped node from the root bone node, which is convenient for adjusting the position of each node after scaling to ensure consistency with the position before scaling; the other is the length attribute value of the bone bone. After scaling, the length value of the bone bone is often invalid. After calculation, it can be forced to scale according to the scaling ratio to make it consistent before and after scaling. Specifically, the initial offset between the position of the node and the position of the root bone node is originOffset = biped root bone node position coordinate node.transform.pos - biped child bone node position coordinate bipedRoots.transform.pos; after scaling, the offset between the position of the node and the position of the root bone node is afterOffset = originOffset * user preset scaling ratio scale; after scaling, the position coordinate of the node is biped-afterPos = afterOffset + bipedRoots.transform.pos. Initially, the length attribute value of the bone bone is originlength = Bone root bone node position coordinate node.transform.pos - Bone child bone node position coordinate lengthRoots.transform.pos; after scaling, the target length attribute value of the bone bone is afterlength = originlengtht * user preset scaling ratio scale; after scaling, the position coordinate of the bone bone node is Bone-afterPos = afterlength + lengthRoots.transform.pos.
[0135] In an optional embodiment of the present invention, after the step of determining the target model, the method further includes:
[0136] When a constraint relationship exists between the first skeletal nodes, the constraint relationship is released.
[0137] In practical applications, generally speaking, the bone model made based on bionics is like a biological bone, and some bone nodes often have constraint relationships for constraining multiple target objects. It can be seen from the above that the position and size of the bones with constraint relationships will be offset after scaling. Therefore, the embodiment of the present invention can first traverse all the first bone nodes in the target model to determine whether there is a constraint relationship in the first bone node, and if there is a constraint relationship in the first bone node, the constraint relationship for the first bone node can be released.
[0138] For example, in 3D Max, if nodeA has a position constraint and the target object is nodeB, then record: 'Position_Constraint':nodeA,nodeB; unbind the position constraint on nodeA, that is, remove the controller of the constraint on the position, that is, now the displacement of nodeB will not cause the displacement of nodeA.
[0139] In the embodiment of the present invention, when a constraint relationship exists in the first bone node, the constraint relationship for the first bone node can be released, thereby avoiding bone deformation during the scaling process of the model.
[0140] In an optional embodiment of the present invention, the constraint relationship includes a constraint type and a link relationship; after the step of scaling the target model according to the scaling parameter based on the first hierarchical relationship, the method further includes:
[0141] Based on the first hierarchical relationship, in accordance with a preset order, the target first skeletal node that deviates from the first target position coordinate is placed on the first target position coordinate, and the other first skeletal nodes that deviate from the second target position coordinate are placed on the second target position coordinate;
[0142] When the length attribute value of the other bone is different from the target length attribute value, adopting the target length attribute value as the length attribute value of the other bone;
[0143] The constraint type and the link relationship are used to restore the constraint relationship for the plurality of first skeletal nodes.
[0144] In actual applications, there may be some bone nodes that deviate from the position corresponding to the scaling parameter. Therefore, the embodiment of the present invention can place the target first bone node that deviates from the first target position coordinate on the first target position coordinate in a preset order based on the level number to which the first bone node belongs, and place other first bone nodes that deviate from the second target position coordinate on the second target position coordinate. For example, first place the Biped bone node of the 0th layer that deviates from the position corresponding to the scaling parameter on Biped-afterPos, and place the bone bone node that deviates from the position corresponding to the scaling parameter on Bone-afterPos, then place the Biped bone node of the 1st layer that deviates from the position corresponding to the scaling parameter on Biped-afterPos, and place the bone bone node that deviates from the position corresponding to the scaling parameter on Bone-afterPos, and so on.
[0145] In actual applications, other bones may also be deformed after scaling because the length attribute changes are not considered during the scaling process. Therefore, the embodiment of the present invention can also use the target length attribute value as the length attribute value of other bones when the length attribute value of other bones is different from the target length attribute value. For example, when the length of the bone bone is not afterlength after scaling, afterlength is used as the length attribute of the bone bone.
[0146] The embodiment of the present invention can place the bone nodes that deviate from the target position into the corresponding target position coordinates to ensure that all target first bone nodes and other first bone nodes do not deviate from the target position. It can also calculate the target length attribute value through the initial length attribute value, and then force other bones to be scaled according to the target length attribute value to ensure consistency before and after scaling, thereby avoiding model deformation caused by bone length.
[0147] After scaling is complete, to restore the model to its original state, embodiments of the present invention can restore the constraint relationships of each skeletal node. Specifically, the constraint relationships of embodiments of the present invention can include constraint types and link relationships. For example, constraint types can include Link Constraint, Position Constraint, LookAt Constraint, and other constraints. Link Constraint is a constraint where the scaling and displacement of the target object will affect the size and position of the constrained node. Position Constraint / LookAt Constraint is a constraint where the displacement of the target object will affect the position of the constrained node. The link relationship can be illustrated by an example: A has a position constraint added, the target object is B, the constraint type is Position Constraint, and the link relationship is A->B, that is, A is restricted by B, that is, A is constrained by B's position. When releasing the constraint relationship, embodiments of the present invention can record the constraint type and link relationship of each skeletal node. After scaling is complete, the constraint relationships of all skeletal nodes in the model can be restored based on the constraint type and link relationship, so that each skeletal node in the model is restored to its state before scaling.
[0148] In an optional embodiment of the present invention, after the step of determining a target first skeletal node from the plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node, the method further includes:
[0149] The target first skeletal node is arranged using the first hierarchical relationship, and when a special skeletal node constraint relationship exists for the target first skeletal node, the special skeletal node constraint relationship is released.
[0150] In an optional embodiment of the present invention, the method may further include:
[0151] A non-scalable bone node is determined from the plurality of first bone nodes, and the non-scalable bone node is modified into a scalable bone node.
[0152] In actual applications, the types of bone nodes are diverse. For the unique properties of different bone nodes, some nodes may fail to scale after scaling, such as the Editable_mesh bone. This is because some bone types are non-scalable types by default in the system. Therefore, the embodiment of the present invention can traverse all bone node types in the first bone node before scaling the model, and convert the non-scalable bone node types into scalable node types in advance.
[0153] The embodiment of the present invention determines a non-scalable bone node from multiple first bone nodes and modifies the non-scalable bone node into a scalable bone node, thereby ensuring that the model will not be affected by the non-scalable bone node during scaling, avoiding bone deformation after scaling due to the non-scalable bone node, and thus improving the scaling efficiency of the model.
[0154] From the above, it can be seen that because the special bone node has a target first bone node controller, when the constraint relationship of the first bone node is released for the entire model, some special bone nodes may not be untied. Therefore, the embodiment of the present invention can use the first hierarchical relationship to arrange the target first bone node, traverse the queue, and when there is a special bone node constraint relationship for the target first bone node, release the special bone node constraint relationship to ensure that all bone nodes are not constrained during the scaling process, thereby further improving the automatic scaling mechanism.
[0155] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0156] Reference Figure 7 , shows a structural block diagram of a model scaling device provided in an embodiment of the present invention, which may specifically include the following modules:
[0157] The target model determination module 701 is used to determine the target model; the target model includes a plurality of first skeletal nodes;
[0158] A first hierarchical relationship determining module 702, configured to determine a first hierarchical relationship between a plurality of the first skeletal nodes;
[0159] A special skeletal node distinguishing module 703 is configured to determine a target first skeletal node from a plurality of first skeletal nodes, and other first skeletal nodes in the target model other than the target first skeletal node; the target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for the other first skeletal nodes; the target first skeletal node includes a first root skeletal node and a first child skeletal node, and the other first skeletal nodes include a second root skeletal node and a second child skeletal node;
[0160] A scaling parameter calculation module 704 is configured to calculate scaling parameters for a plurality of skeletal nodes based on the first root skeletal node, the first child skeletal node, the second root skeletal node, and the second child skeletal node;
[0161] The model scaling module 705 is configured to scale the target model according to the scaling parameter based on the first hierarchical relationship.
[0162] Optionally, the target model determination module may include:
[0163] a second hierarchical relationship determination submodule, configured to traverse the second skeletal nodes and determine a second hierarchical relationship between a plurality of the second skeletal nodes;
[0164] The sub-skeletal node enterprise does not dare to sub-module, for determining a third sub-skeletal node from a plurality of the second skeletal nodes based on the second hierarchical relationship;
[0165] A target second skeletal node determination submodule is configured to determine a target second skeletal node from a plurality of the second skeletal nodes; the target second skeletal node includes a third skeletal node;
[0166] A third skeletal node determination submodule is configured to determine a target third skeletal node corresponding to the parent skeletal node from the third skeletal node when the parent skeletal node corresponding to the third child skeletal node has other child skeletal nodes;
[0167] A child skeleton node adding submodule, configured to add the other child skeleton nodes to the target third skeleton node when the other child skeleton nodes have no association relationship with the target third skeleton node;
[0168] The target model determination submodule is used to take the third root skeleton node and the child skeleton nodes associated with the third root skeleton node as a target model.
[0169] Optionally, the device may further include:
[0170] The constraint relationship releasing module is used to release the constraint relationship when a constraint relationship exists on the first skeletal node.
[0171] Optionally, the other first bone nodes have corresponding other bones, the first root bone node has corresponding root special bone node coordinates, the first child bone node has corresponding first child bone node coordinates, the second root bone node has corresponding second root bone node coordinates, the second child bone node has corresponding second child bone node coordinates, and the scaling parameter calculation module may include:
[0172] A first offset calculation submodule, configured to calculate a first offset for the first root skeletal node and the first child skeletal node using the coordinates of the root special skeletal node and the coordinates of the first child skeletal node;
[0173] A second offset calculation submodule, configured to calculate a second offset of the first root skeleton node and the first child skeleton node after scaling by using the first offset and a preset scaling ratio;
[0174] A first target position coordinate calculation submodule, configured to calculate a first target position coordinate for the target first skeletal node using the second offset and the first child skeletal node coordinates;
[0175] A third offset calculation submodule, configured to calculate initial length attribute values for the other bones using the coordinates of the second root bone node and the coordinates of the second child bone node;
[0176] a fourth offset calculation submodule, configured to calculate target length attribute values for the other bones using the initial length attribute value and a preset scaling ratio;
[0177] A second target position coordinate calculation submodule, configured to calculate the second target position coordinates for the other first skeletal nodes using the target length attribute value and the coordinates of the second child skeletal node;
[0178] The scaling parameter determination submodule is configured to use the first target position coordinates and the second target position coordinates as scaling parameters.
[0179] Optionally, the constraint relationship includes a constraint type and a link relationship, and the apparatus may further include:
[0180] a skeletal node correction module, configured to, based on the first hierarchical relationship and in a preset order, place the target first skeletal node that deviates from the first target position coordinates at the first target position coordinates, and place the other first skeletal nodes that deviate from the second target position coordinates at the second target position coordinates;
[0181] a length attribute value replacement module, configured to adopt the target length attribute value as the length attribute value of the other bone when the length attribute value of the other bone is different from the target length attribute value;
[0182] A constraint relationship recovery module is used to use the constraint type and the link relationship to recover the constraint relationship for multiple first skeletal nodes.
[0183] Optionally, the device may further include:
[0184] The special bone node constraint relationship releasing module is used to arrange the target first bone node using the first hierarchical relationship, and when a special bone node constraint relationship exists for the target first bone node, release the special bone node constraint relationship.
[0185] Optionally, the device may further include:
[0186] The scalable bone node modification module is used to determine a non-scalable bone node from the plurality of first bone nodes, and modify the non-scalable bone node into a scalable bone node.
[0187] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0188] In addition, an embodiment of the present invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and runnable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned model scaling method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0189] The embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the various processes of the above-mentioned model scaling method embodiment are implemented, and the same technical effects are achieved. To avoid repetition, the details are not described here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0190] Figure 8 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0191] The electronic device 800 includes but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, a processor 810, and a power supply 811. It will be understood by those skilled in the art that Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or may combine certain components or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle terminal, a wearable device, and a pedometer.
[0192] It should be understood that in this embodiment of the present invention, the RF unit 801 can be used to receive and transmit signals during information transmission or calls. Specifically, it receives downlink data from the base station and transmits it to the processor 810 for processing; in addition, it transmits uplink data to the base station. Typically, the RF unit 801 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, and the like. Furthermore, the RF unit 801 can communicate with the network and other devices via a wireless communication system.
[0193] The electronic device provides users with wireless broadband Internet access through the network module 802, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0194] The audio output unit 803 can convert audio data received by the RF unit 801 or the network module 802 or stored in the memory 809 into an audio signal and output it as sound. In addition, the audio output unit 803 can also provide audio output related to specific functions performed by the electronic device 800 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 803 includes a speaker, a buzzer, a receiver, etc.
[0195] The input unit 804 is used to receive audio or video signals. The input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The graphics processor 8041 processes image data of a still picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frames can be displayed on the display unit 806. The image frames processed by the graphics processor 8041 can be stored in the memory 809 (or other storage medium) or transmitted via the radio frequency unit 801 or the network module 802. The microphone 8042 can receive sound and process such sound into audio data. The processed audio data can be converted into a format that can be sent to a mobile communication base station via the radio frequency unit 801 in the case of a telephone call mode.
[0196] The electronic device 800 also includes at least one sensor 805, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 8061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 8061 and / or the backlight when the electronic device 800 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 805 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0197] The display unit 806 is used to display information input by the user or information provided to the user. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0198] The user input unit 807 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the electronic device. Specifically, the user input unit 807 includes a touch panel 8071 and other input devices 8072. The touch panel 8071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 8071). The touch panel 8071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 810, which receives and executes the command sent by the processor 810. In addition, the touch panel 8071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 8071, the user input unit 807 may also include other input devices 8072. Specifically, other input devices 8072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0199] Furthermore, the touch panel 8071 may be overlaid on the display panel 8061. When the touch panel 8071 detects a touch operation on or near it, it transmits the information to the processor 810 to determine the type of touch event. Subsequently, the processor 810 provides corresponding visual output on the display panel 8061 according to the type of touch event. Figure 8 In the figure, the touch panel 8071 and the display panel 8061 are two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 8071 and the display panel 8061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0200] The interface unit 808 is an interface for connecting external devices to the electronic device 800. For example, the external devices may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 808 may be used to receive input (e.g., data information, power, etc.) from the external device and transmit the received input to one or more elements within the electronic device 800, or may be used to transmit data between the electronic device 800 and the external device.
[0201] Memory 809 can be used to store software programs and various data. Memory 809 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function or an image playback function); the data storage area may store data generated based on the use of the mobile phone (such as audio data, a phone book, etc.). Furthermore, memory 809 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0202] The processor 810 is the control center of the electronic device. It connects the various components of the electronic device using various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 809 and accessing data stored in the memory 809, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 810 may include one or more processing units; preferably, the processor 810 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 810.
[0203] The electronic device 800 may also include a power supply 811 (such as a battery) to supply power to each component. Preferably, the power supply 811 may be logically connected to the processor 810 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0204] In addition, the electronic device 800 includes some functional modules not shown, which will not be described here.
[0205] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0206] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0207] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
[0208] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0209] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0210] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0211] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0212] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0213] If the functions are implemented in the form of 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 the present invention, or the part that contributes to the prior art, or part 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 for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, ROM, RAM, a magnetic disk, or an optical disk.
[0214] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A model scaling method, characterized in that: include: Determine the target model; The target model includes a plurality of first skeleton nodes; Determining a first hierarchical relationship between a plurality of the first skeletal nodes; Determine a target first skeletal node from a plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node; the target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for the other first skeletal nodes; the target first skeletal node includes a first root skeletal node and a first child skeletal node, and the other first skeletal nodes include a second root skeletal node and a second child skeletal node; Calculate scaling parameters for the plurality of skeletal nodes based on the first root skeletal node, the first child skeletal node, the second root skeletal node, and the second child skeletal node; Based on the first hierarchical relationship, scaling the target model according to the scaling parameter; The step of determining the target model comprises: Traversing the second skeletal nodes and determining a second hierarchical relationship between a plurality of the second skeletal nodes; Based on the second hierarchical relationship, determining a third child skeletal node from the plurality of second skeletal nodes; Determine a target second skeletal node from the plurality of second skeletal nodes; the target second skeletal node includes a third skeletal node; When the parent skeletal node corresponding to the third child skeletal node has other child skeletal nodes, determining a target third root skeletal node corresponding to the parent skeletal node from the third root skeletal nodes; When the other child skeleton nodes have no association relationship with the target third root skeleton node, the other child skeleton nodes are added to the target third root skeleton node; The third root skeleton node and the child skeleton nodes associated with the third root skeleton node are taken as a target model.
2. The method according to claim 1, characterized in that The other first bone nodes have corresponding other bones, the first root bone node has corresponding root special bone node coordinates, the first child bone node has corresponding first child bone node coordinates, the second root bone node has corresponding second root bone node coordinates, and the second child bone node has corresponding second child bone node coordinates. The step of calculating scaling parameters for the plurality of bone nodes based on the first root bone node, the first child bone node, the second root bone node, and the second child bone node includes: Calculate a first offset for the first root bone node and the first child bone node using the coordinates of the root special bone node and the coordinates of the first child bone node; Calculating a second offset of the first root bone node and the first child bone node after scaling using the first offset and a preset scaling ratio; Calculating first target position coordinates for the target first bone node using the second offset and the first child bone node coordinates; Calculating the initial length attribute value of the other bones using the coordinates of the second root bone node and the coordinates of the second child bone node; Calculating target length attribute values for the other bones using the initial length attribute value and a preset scaling ratio; Calculating the second target position coordinates for the other first skeletal nodes using the target length attribute value and the coordinates of the second child skeletal node; The first target position coordinates and the second target position coordinates are used as scaling parameters.
3. The method according to claim 2, characterized in that After the step of determining the target model, the method further includes: When a constraint relationship exists between the first skeletal nodes, the constraint relationship is released.
4. The method according to claim 3, characterized in that The constraint relationship includes a constraint type and a link relationship. After the step of scaling the target model according to the scaling parameter based on the first hierarchical relationship, the method further includes: Based on the first hierarchical relationship, in accordance with a preset order, the target first skeletal node that deviates from the first target position coordinate is placed on the first target position coordinate, and the other first skeletal nodes that deviate from the second target position coordinate are placed on the second target position coordinate; When the length attribute value of the other bone is different from the target length attribute value, adopting the target length attribute value as the length attribute value of the other bone; The constraint type and the link relationship are used to restore the constraint relationship for the plurality of first skeletal nodes.
5. The method according to claim 1, wherein After the step of determining a target first skeletal node from the plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node, the method further includes: The target first skeletal node is arranged using the first hierarchical relationship, and when a special skeletal node constraint relationship exists for the target first skeletal node, the special skeletal node constraint relationship is released.
6. The method according to claim 1, characterized in that Also includes: A non-scalable bone node is determined from the plurality of first bone nodes, and the non-scalable bone node is modified into a scalable bone node.
7. A model scaling device, characterized in that: include: A target model determination module is used to determine a target model; the target model includes a plurality of first skeletal nodes; A first hierarchical relationship determining module, configured to determine a first hierarchical relationship between a plurality of said first skeletal nodes; A special skeletal node distinguishing module is used to determine a target first skeletal node from a plurality of first skeletal nodes, and other first skeletal nodes in the target model except the target first skeletal node; the target first skeletal node has a corresponding target first skeletal node controller, and the target first skeletal node controller is different from the controllers for the other first skeletal nodes; the target first skeletal node includes a first root skeletal node and a first child skeletal node, and the other first skeletal nodes include a second root skeletal node and a second child skeletal node; A scaling parameter calculation module, configured to calculate scaling parameters for a plurality of skeletal nodes based on the first root skeletal node, the first child skeletal node, the second root skeletal node, and the second child skeletal node; a model scaling module, configured to scale the target model according to the scaling parameter based on the first hierarchical relationship; The target model determination module includes: a second hierarchical relationship determination submodule, configured to traverse the second skeletal nodes and determine a second hierarchical relationship between a plurality of the second skeletal nodes; The sub-skeletal node enterprise does not dare to sub-module, for determining a third sub-skeletal node from a plurality of the second skeletal nodes based on the second hierarchical relationship; A target second skeletal node determination submodule is configured to determine a target second skeletal node from a plurality of the second skeletal nodes; the target second skeletal node includes a third skeletal node; A third skeletal node determination submodule is configured to determine a target third skeletal node corresponding to the parent skeletal node from the third skeletal node when the parent skeletal node corresponding to the third child skeletal node has other child skeletal nodes; A child skeleton node adding submodule, configured to add the other child skeleton nodes to the target third skeleton node when the other child skeleton nodes have no association relationship with the target third skeleton node; The target model determination submodule is used to take the third root skeleton node and the child skeleton nodes associated with the third root skeleton node as a target model.
8. An electronic device, characterized in that: comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to implement the method according to any one of claims 1 to 6 when executing a program stored in the memory.
9. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Skeleton processing method and device for virtual object, equipment and storage medium
CN111598987A
Processing method and device for model in game, equipment and storage medium
CN111973988A