Model generation method and apparatus, electronic device, and storage medium
The model generation method empowers users to customize three-dimensional models by editing and merging model units, overcoming limitations in existing manufacturing methods to enhance user experience.
Patent Information
- Application Number
- US19/128100
- Authority / Receiving Office
- US · United States
- Patent Type
- Applications(United States)
- Current Assignee / Owner
- Priority Date
- 2023-05-18
- Filing Date
- 2024-04-25
- Publication Date
- 2026-11-26
AI Technical Summary
Existing methods for manufacturing three-dimensional model resources for mobile terminal applications, such as games, limit user selection and customization, affecting the user experience.
A model generation method that allows users to edit model skeletons, determine model units based on skeleton parameters, and merge these units to create a target model matching the desired morphology, which is then displayed on an interface.
Enables users to freely create animation models, breaking the limitations of pre-manufactured resources and meeting diverse design requirements.
Smart Images

Figure US20260378161A1-D00000_ABST
Abstract
Description
[0001] This application claims the priority to and benefits of Chinese Patent Application No. 202310565335.7, filed on May 18, 2023, and the aforementioned patent application is hereby incorporated by reference in its entirety.TECHNICAL FIELD
[0002] Embodiments of the present disclosure relates to a model generation method, an apparatus, an electronic device, and a storage medium.BACKGROUND
[0003] Currently, three-dimensional model resources used in mobile terminal applications are usually pre-manufactured by artist in art tools, for example, model resources are manufactured through 3D Max. After the model resources are manufactured, the model resources may be used in the mobile terminal applications. For example, the manufactured model resources may be used in a game client of a mobile terminal. However, existing manufacturing manners of model resources have manufacturing limitations. As a result, selection of model resources by the user has some limitations, affecting experience of using applications by the user.SUMMARY
[0004] Embodiments of the present disclosure provide a model generation method, an apparatus, an electronic device, and a storage medium.
[0005] In a first aspect, the present disclosure provides a model generation method, which includes: obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part; determining a model unit for each model skeleton of the model part based on the skeleton parameter; and merging model units of model skeletons, to obtain a target model matching the part morphology, and displaying the target model on a display interface.
[0006] In an optional implementation, the merging model units of model skeletons, to obtain a target model matching the part morphology includes: determining area marking points of a model editing area of the target model; determining model vertexes based on the area marking points and the model units of the model skeletons, and connecting the model vertexes, to obtain a plurality of model meshes; and splicing the plurality of model meshes to obtain the target model.
[0007] In an optional implementation, the area marking points are voxel vertexes of respective voxels in the model editing area; and the determining model vertexes based on the area marking points and the model units of the model skeleton includes: determining a first position relationship between each voxel vertex and each model unit, wherein the first position relationship is used for indicating whether the voxel vertex is located inside the model unit; determining a target edge in the voxel based on the first position relationship, wherein the target edge is an edge that is in the voxel and that has an intersection point with the model unit; and determining the model vertexes based on a position coordinate of a target voxel vertex located on the target edge.
[0008] In an optional implementation, the determining a target edge in the voxel based on the first position relationship includes: obtaining a target mapping table, wherein the target mapping table is used for representing various position relationships between a voxel vertex for a voxel and each model unit, and an intersection relationship between an edge of the voxel and the model unit; determining an intersection relationship matching the first position relationship based on the target mapping table; and determining the target edge in the voxel based on a matched intersection relationship.
[0009] In an optional implementation, the determining a first position relationship between each voxel vertex and each model unit includes: determining distance between each voxel vertex and a model center of each model unit; and determining the first position relationship between each voxel vertex and each model unit based on the distance.
[0010] In an optional implementation, the method further includes: determining a vertex normal line of each model vertex of the target model; and determining luminance rendering information of the target model according to the vertex normal line, and performing luminance rendering on the target model based on the luminance rendering information.
[0011] In an optional implementation, the obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user includes: obtaining a spine skeleton parameter of each spine skeleton of a spine model in response to a first editing operation on the spine model, wherein the spine skeleton parameter is used for indicating a spine morphology of a spine part associated with the spine skeleton; and / or obtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model, wherein the limb skeleton parameter is used for indicating a limb morphology of a limb part associated with the limb skeleton.
[0012] In an optional implementation, the obtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model includes: obtaining a skeleton position parameter of each limb skeleton in response to a position editing operation on the limb skeleton; and / or obtaining a muscle morphology parameter of a limb muscle associated with the limb model in response to a muscle editing operation on the limb skeleton, wherein the muscle morphology parameter is used for indicating a model size of a model unit corresponding to each limb skeleton.
[0013] In an optional implementation, the model part is a limb model, the model skeleton is a limb skeleton, and the method further includes: determining an extension-retraction distance of the limb model in response to an extension-retraction operation on the limb model in the target model, and adjusting a model quantity of model units in the limb model according to the extension-retraction distance; and determining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model.
[0014] In an optional implementation, the determining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model includes: determining that a model gap between a first model unit and a second model unit adjacent to the first model unit is a first value in response to determining that the extension-retraction distance does not meet a distance requirement, wherein the first value is an absolute value of a difference between the extension-retraction distance and a second value, the second value is a product between a model quantity of a third model unit and the model gap, and the third model unit is another model unit other than the first model unit; and determining that a model gap between third model units is the model gap, and determining that a model size of the first model unit is the first value.
[0015] In a second aspect, the present disclosure provides a model generation apparatus, which includes: an obtaining unit, configured to obtain a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part; a determining unit, configured to determine a model unit for each model skeleton of the model part based on the skeleton parameter; a merging unit, configured to merge model units of model skeletons, to obtain a target model matching the part morphology; and a display unit, configured to display the target model on a display interface.
[0016] In a third aspect, the present disclosure provides an electronic device, which includes a processor, a memory, and a bus, wherein the memory stores a machine-readable instruction executable by the processor, and when the electronic device runs, the processor communicates with the memory via the bus, and when the machine-readable instruction is executed by the processor, the steps in the above-mentioned first aspect or any possible implementation of the first aspect are performed.
[0017] In a first aspect, the present disclosure provides a computer-readable storage medium, when the computer program is executed by a processor, the steps in the above-mentioned first aspect or any possible implementation of the first aspect are performed.BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly describe the technical solutions of embodiments of the present disclosure, the following briefly describes the accompanying drawings to be used in embodiments. The accompanying drawings herein are incorporated in this specification and form a part of this specification, show embodiments consistent with the present disclosure, and are used together with this specification to describe the technical solutions of the present disclosure. It should be understood that the following accompanying drawings show only some embodiments of the present disclosure, and therefore should not be regarded as limiting the scope, and a person of ordinary skill in the art may further obtain other relevant accompanying drawings from these accompanying drawings without creative efforts.
[0019] FIG. 1 is a flowchart of a model generation method according to an embodiment of the present disclosure;
[0020] FIG. 2 is a schematic diagram of a model effect of a target model according to an embodiment of the present disclosure;
[0021] FIG. 3 is a schematic diagram of an editing effect of a spine model according to an embodiment of the present disclosure;
[0022] FIG. 4 is a schematic diagram of an effect of editing a skeleton quantity of spine skeletons of a spine model according to an embodiment of the present disclosure;
[0023] FIG. 5 is a schematic diagram of an effect of editing a skeleton position of a spine skeleton of a spine model according to an embodiment of the present disclosure;
[0024] FIG. 6 is a schematic diagram of an effect of editing a skeleton weight of a spine skeleton of a spine model according to an embodiment of the present disclosure;
[0025] FIG. 7 is a schematic diagram of an editing effect of a limb model according to an embodiment of the present disclosure;
[0026] FIG. 8 is a schematic diagram of an editing effect of another limb model according to another embodiment of the present disclosure;
[0027] FIG. 9 is a flowchart of a specific method for merging model units of model skeletons to obtain a target model matching a part morphology in a model generation method according to an embodiment of the present disclosure;
[0028] FIG. 10 is a schematic diagram of a model generation apparatus according to an embodiment of the present disclosure; and
[0029] FIG. 11 is a schematic diagram of an electronic device according to an embodiment of the present disclosure.DETAILED DESCRIPTION
[0030] To make the objectives, technical solutions, and advantages of embodiments of the present disclosure clearer, the following clearly and completely describes the technical solutions in embodiments of the present disclosure with reference to the accompanying drawings in embodiments of the present disclosure. Apparently, the described embodiments are merely some rather than all of the embodiments of the present disclosure. The components in embodiments of the present disclosure described and shown in the accompanying drawings herein may be usually arranged and designed in a variety of different configurations. Therefore, the following detailed descriptions of embodiments of the present disclosure provided in the accompanying drawings are not intended to limit the scope of the present disclosure for which protection is claimed, but rather represents only selected embodiments of the present disclosure. Based on embodiments of the present disclosure, all other embodiments obtained by a person skilled in the art without creative efforts fall within the protection scope of the present disclosure.
[0031] It should be noted that similar reference numerals and letters indicate similar items in the following accompanying drawings, so that once an item is defined in one accompanying drawing, it does not need to be further defined and explained in subsequent accompanying drawings.
[0032] The term “and / or” in this specification describes only an association relationship, and indicates that three relationships may exist. For example, A and / or B may represent: Only A exists, both A and B exist, and only B exists. In addition, the term “at least one” in this specification indicates any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C may indicate including any one or more elements selected from a set consisting of A, B, and C.
[0033] It is found through research that, three-dimensional model resources used in mobile terminal applications are usually pre-manufactured by fine art people in fine art tools, for example, model resources are manufactured through 3D Max. After the model resources are manufactured, the model resources may be used in the mobile terminal applications. For example, the manufactured model resources may be used in a game client of a mobile terminal. However, existing manufacturing manners of model resources have manufacturing limitations. As a result, selection of model resources by the user has some limitations, affecting experience of using applications by the user.
[0034] Based on the foregoing research, the present disclosure provides a model generation method, an apparatus, an electronic device, and a storage medium. In embodiments of the present disclosure, a user may edit a model in an application. At this time, the application may obtain, in response to a model editing operation of the user, a skeleton parameter of each model skeleton of a model part that is edited by the user. Then, the application may determine a model unit for each model skeleton of the model part based on the skeleton parameter, and merge model units of model skeletons, to obtain a target model matching the part morphology, and display the target model on a display interface of the application.
[0035] In the foregoing implementation, the user can edit and create an animation model in the application in a running state, for example, the user can edit and create the animation model in a game program in a running state. Through the foregoing processing manner, the user can freely create an expected animation model, to break through limitation in the conventional technology that an artist needs to select in model resources that are preset, so as to meet a plurality of animation design requirements of the user.
[0036] To facilitate the understanding of this embodiment, a model generation method disclosed in this embodiment of the present disclosure is first described in detail, and an execution body of the model generation method provided in this embodiment of the present disclosure is generally an electronic device having a particular computing capability. The electronic device includes, for example, a terminal device, a server, or another processing device, and the terminal device may be user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a handheld device, a computing device, or the like. In some possible implementations, the model generation method may be implemented by a processor by invoking a computer-readable instruction stored in a memory.
[0037] FIG. 1 is a flowchart of a model generation method according to an embodiment of the present disclosure. The method includes steps S101 to S105.
[0038] S101: obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, the skeleton parameter is used for indicating a part morphology of the model part.
[0039] The model generation method provided in embodiments of the present disclosure may be used to any type of application including model resources. For example, the application may be a game application. At this time, a model editing trigger button is disposed in the game application, and after a trigger operation of the user for the model editing trigger button is detected, it is determined that a model editing operation of the user is detected.
[0040] Then, the user may generate, in the game application according to the model generation method provided in this embodiment of the present disclosure, a corresponding model for a game role that the user wants to play, that is, a target model. At this time, the application may include an editing interaction interface, and the user may edit the model by using the editing interaction interface.
[0041] During specific implementation, the application may detect the model editing operation of the user, and obtain, in response to the model editing operation, the skeleton parameter of each model skeleton of the model part that is edited by the user. The skeleton parameter includes a skeleton quantity, a skeleton weight, and a skeleton position. The skeleton quantity is used to indicate a quantity of model skeletons included in the model part. The skeleton weight is used to indicate a part morphology (or a part size) of a sub-part that is associated with the model skeleton and that is in the model part. The skeleton position is used to indicate a position at which the model skeleton is located.
[0042] In this embodiment of the present disclosure, the model part may be classified into a spine model and a limb model. At this time, the model skeleton may be classified into a spine skeleton and a limb skeleton. That is, the user may edit the spine model and the limb model on the editing interaction interface, and then obtain the skeleton parameter of the spine skeleton in response to the model editing operation on the spine model, and obtain the skeleton parameter of the limb skeleton in response to the model editing operation on the limb model.
[0043] S103: determining a model unit for each model skeleton of the model part based on the skeleton parameter.
[0044] Herein, the model unit may be determined for each model skeleton of the model part based on the skeleton quantity and the skeleton weight. The model unit may be a metaball model. During specific implementation, one metaball model may be determined for each model skeleton based on the skeleton quantity, the skeleton position of the model skeleton is used as a sphere center of the metaball model, and the skeleton weight of the model skeleton is used as a sphere radius of the metaball model.
[0045] S105: merging model units of model skeletons, to obtain a target model matching the part morphology, and displaying the target model on a display interface.
[0046] After the model units are determined for each model skeleton of each model part, model merging may be performed on the model units, so as to obtain the target model matching the part morphology. For example, FIG. 2 is a schematic model diagram of an optional target model.
[0047] In this embodiment of the present disclosure, the user may edit the model in the application. At this time, the application may obtain, in response to the model editing operation triggered by the user, the skeleton parameter of each model skeleton of the model part that is edited by the user. Then, the application may determine the model unit for each model skeleton of the model part based on the skeleton parameter, and merge the model units of the model skeletons, to obtain the target model matching the part morphology, and display the target model on the display interface of the application.
[0048] In the foregoing implementation, the user can edit and create an animation model in the application in a running state, for example, the user can edit and create the animation model in a game program in a running state. In the foregoing processing manner, the user can freely create an expected animation model, to break through limitation in the conventional technology that an artist needs to select in model resources that are preset, so as to meet a plurality of animation design requirements of the user.
[0049] The following describes the foregoing steps in detail with reference to specific implementations.
[0050] In an optional implementation, the foregoing step S101 of obtaining a skeleton parameter of each model skeleton in response to a model editing operation of a user specifically includes the following steps:
[0051] Step S1011: obtaining a spine skeleton parameter of each spine skeleton of a spine model in response to a first editing operation on the spine model, the spine skeleton parameter is used for indicating a spine morphology of a spine part associated with the spine skeleton.
[0052] In this embodiment of the present disclosure, the model editing operation of the user is first detected, and then the skeleton parameter of each model skeleton of the edited model part is obtained in response to the model editing operation. The following describes the foregoing model editing operation with reference to FIG. 2 to FIG. 5 by using an example in which the model part is the spine model.
[0053] In this embodiment of the present disclosure, first, the application is started, and a type of a model selected to be created by the user is received. The model type indicates a type of a model to be created, and / or a type of the model to be crated. A model editing area is created based on the model type, and a to-be-edited model in an initial state is displayed in the model editing area. Herein, the to-be-edited model in the initial state may be a spine model in the initial state. Being in the initial state means that the skeleton quantity of the spine model is an initial quantity, for example, 1 or 2, which is not specifically limited in the present disclosure.
[0054] Next, the first editing operation of the user on the spine model may be detected, and after the first editing operation is detected, the spine skeleton parameter of each spine skeleton of the spine model is obtained. The spine skeleton parameter includes: the skeleton quantity of the spine skeleton, the skeleton weight of the spine skeleton, and the skeleton position of the spine skeleton
[0055] During specific implementation, a quantity editing operation of the user on the spine model may be detected. As shown in FIG. 3, two sides of the spine model include arrows. At this time, a dragging operation or a tapping operation of the user on left and right arrows may be detected to detect the quantity editing operation. For example, for the right arrow, if a rightward dragging operation of the user for the right arrow is detected, it is determined that the quantity editing operation is detected, and the quantity editing operation is an operation that indicates to increase a quantity of spine skeletons from the right side of the spine model. For example, for FIG. 3, after the user drags the right arrow rightward, the spine model shown in FIG. 4 may be obtained. For another example, for the right arrow, if a leftward dragging operation of the user for the right arrow is detected, it is determined that the quantity editing operation is detected, and the quantity editing operation is an operation of indicating to decrease a quantity of spine skeletons from the right side of the spine model.
[0056] Herein, in a process of editing the skeleton quantity of spine skeletons, the user may further edit the skeleton position of the spine skeleton and / or the skeleton weight of the spine skeleton of the spine model.
[0057] In an optional implementation, a skeleton dragging operation of the user on the spine skeleton in the spine model may be detected, and a skeleton orientation of the dragged spine skeleton is determined according to the skeleton dragging operation, the skeleton orientation includes a position and a direction of the spine skeleton. Then, a skeleton orientation of another spine skeleton may be determined based on the skeleton orientation of the dragged spine skeleton. At this time, the skeleton position of the spine skeleton may be determined based on the skeleton orientation of each spine skeleton. For example, FIG. 5 shows a spine model obtained after the skeleton position is edited.
[0058] In another optional implementation, a skeleton tapping operation of the user on the spine skeleton in the spine model may be detected, and a tapped spine skeleton is determined based on the skeleton tapping operation. Then, a skeleton weight of the tapped spine skeleton may be adjusted based on an operation quantity of skeleton tapping operations.
[0059] The skeleton weight of the tapped spine skeleton may be adjusted according to a preset value for each skeleton tapping operation. For example, the skeleton weight of the tapped spine skeleton may be decreased or increased according to the preset value. For example, FIG. 6 shows a spine model obtained after the skeleton weight is edited.
[0060] Step S1012: obtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model, the limb skeleton parameter is used for indicating a limb morphology of a limb part associated with the limb skeleton.
[0061] In this embodiment of the present disclosure, after the spine model is edited in the foregoing manner, the limb model may be further edited. Herein, an editing operation of the user on the limb model may be detected, to obtain the limb skeleton parameter of each limb skeleton of the limb model, where the limb skeleton parameter includes a skeleton weight of the limb skeleton and a skeleton position of the limb skeleton.
[0062] In a process of editing the limb model, the skeleton position and the skeleton weight of each limb skeleton of the limb model may be edited. The following describes the second editing operation on the limb model with reference to FIG. 7 to FIG. 8 by using an example in which the model part is the limb model.
[0063] In embodiments of the present disclosure, a plurality of limb templates may be preset in the application. For example, a plurality of templates may be set for arms, legs, a neck, a tail, wings, an ornament, and the like. Then, tapping and dragging operations of the user on the limb template may be detected. After it is detected that the limb template is dragged to the model editing area and it is detected that the limb template is released, a limb model corresponding to the limb template is added to the spine model in the model editing area. For example, four limbs may be added to the spine model, to obtain the model shown in FIG. 7.
[0064] Corresponding articulation points are preset for each limb template. Positions and / or quantities of articulation points of different limb templates are not completely the same. Herein, the articulation points preset in the limb template may be understood as the limb skeletons of the limb model. For each limb skeleton of the limb template, an initial skeleton weight is preset, the initial skeleton weight is used to describe an initial limb morphology corresponding to the limb part.
[0065] After adding the limb model to the spine model, the user may edit the skeleton position and the skeleton weight of the limb skeleton of the limb model.
[0066] During specific implementation, after a position editing operation of the user on the limb skeleton in the limb model is detected, a skeleton position parameter of each limb skeleton may be obtained in response to the position editing operation on the limb skeleton, the skeleton position parameter may be understood as position coordinates of the limb skeleton. Herein, the position editing operation may be detected by detecting a dragging operation of the user on the limb skeleton (or the articulation point), so as to determine the skeleton position parameter of the dragged limb skeleton according to a position at which the user drags the limb skeleton.
[0067] During specific implementation, a muscle morphology parameter of a limb muscle associated with the limb model (that is, the skeleton weight of the limb skeleton) may alternatively be obtained in response to a muscle editing operation on the limb skeleton after the muscle editing operation of the user on the limb skeleton in the limb model is detected, the muscle morphology parameter is used to indicate a model size of a model unit corresponding to each limb skeleton.
[0068] Herein, a plurality of muscle files may be preset, and each muscle file corresponds to one muscle morphology. In other words, the muscle file may be associated with a change manner of a metaball model of each limb skeleton in the limb model. For example, the muscle file may include a sphere radius of the metaball model of each limb skeleton of the limb model.
[0069] In this embodiment of the present disclosure, a file selection operation of the user on the muscle file may be detected to detect the muscle editing operation. After the file selection operation is detected, the selected muscle file may be determined, then a sphere radius of a corresponding metaball model of the limb model may be modified according to the sphere radius included in the muscle file, and the limb model of a corresponding muscle morphology may be obtained after modification. For example, the animation model shown in FIG. 8 may be obtained.
[0070] In this embodiment of the present disclosure, after the skeleton parameter of each model skeleton of the edited model part is obtained in the foregoing manner, the target model matching the part morphology may be generated in the process described in the foregoing steps S103 and S105, and the target model is displayed on the display interface. For example, the spine model is displayed on the editing interaction interface shown in FIG. 2 to FIG. 6.
[0071] In an optional implementation, as shown in FIG. 9, the foregoing step S105 of merging model units of model skeletons, to obtain a target model matching the part morphology specifically includes the following steps:
[0072] Step S901: determining area marking points of a model editing area of the target model.
[0073] Step S902: determining model vertexes based on the area marking points and the model units of the model skeletons, and connecting the model vertexes, to obtain a plurality of model meshes.
[0074] Step S903: splicing the plurality of model meshes to obtain the target model.
[0075] In this embodiment of the present disclosure, first, one metaball model (that is, a model unit) is determined for each model skeleton based on the skeleton quantity. For example, the skeleton position of the model skeleton is used as a sphere center of the metaball model, and the skeleton weight of the model skeleton is used as a sphere radius of the metaball model. Then, the model editing area is divided into a plurality of voxels. For example, the model editing area may be divided into a plurality of cubes or cuboids, where the cubes or cuboids are voxels. Then, area marking points of the model editing area may be determined based on the plurality of voxels. For example, a voxel vertex and / or a voxel center of each voxel may be determined as the area marking point.
[0076] After the area marking points are determined, field values between the area marking points and the metaball models may be determined, so as to determine position relationships between the area marking points and the metaball models based on the field values. After the position relationships are determined, the model vertexes may be determined based on the position relationships, where the model vertexes may be understood as intersection points between edges of the voxels and the metaball models. Then, the model vertexes may be spliced to obtain the plurality of model meshes, and the plurality of model meshes are spliced to obtain the target model.
[0077] In the foregoing implementation, in the manner of determining the model vertexes based on the field values between the area marking points and the model units, the model vertexes can be determined more quickly, so as to obtain the target model quickly, and a relatively good animation model can still be obtained for an application that has a relatively high requirement for time validity.
[0078] When the area marking points are voxel vertexes of respective voxels in the model editing area, in an optional implementation, the foregoing step S902 of determining model vertexes based on the area marking points and the model units of the model skeletons includes the following steps:
[0079] Step S9021: determining a first position relationship between each voxel vertex and each model unit, wherein the first position relationship is used for indicating whether the voxel vertex is located inside the model unit.
[0080] Step S9022: determining a target edge in the voxel based on the first position relationship, wherein the target edge is an edge that is in the voxel and that has an intersection point with the model unit.
[0081] Step S9023: determining the model vertexes based on a position coordinate of a target voxel vertex located on the target edge.
[0082] In this embodiment of the present disclosure, the first position relationship between each voxel vertex of each voxel and each metaball model may be determined. For example, if the voxel is a cube (or a cuboid), it may be determined that voxel vertexes are eight vertexes of the cube (or the cuboid). Next, a field value between each voxel vertex and the metaball model may be calculated, so as to determine the first position relationship based on the field value. The field value is determined based on a distance between the voxel vertex and a sphere center of the metaball model.
[0083] Herein, a distance between each voxel vertex and a model center of each model unit may be determined; and the first position relationship between each voxel vertex and each model unit is determined based on the distance.
[0084] For example, the distance between the voxel vertex and the sphere center may be determined, and a ratio of the distance to the sphere radius (or, a ratio of the sphere radius to the distance) is determined, so as to determine the field value based on the ratio. For example, the ratio may be determined as the field value, or a square and a cube of the ratio and other values determined based on the ratio are determined as the field value. A manner of calculating the field value is not specifically limited in the present disclosure, provided that the field value can be calculated.
[0085] Herein, the first position relationship is a position relationship that is between each area marking point and each metaball model and that is described in the foregoing implementation. It may be determined, based on the first position relationship, whether the voxel vertex is located inside the metaball model. That is, it may be determined, based on the first position relationship, whether the voxel vertex is located inside the metaball model or located outside the metaball model.
[0086] It is assumed that the field value is the ratio of the sphere radius to the distance (the distance between the voxel vertex and the sphere center). If the ratio is less than a field value threshold, it is determined that the voxel vertex is located outside the metaball model, and has no interaction point with the metaball model. If the ratio is greater than the field value threshold, it is determined that the voxel vertex is located inside the metaball model, and has no interaction point with the metaball model. The field value threshold may be understood as the ratio of the sphere radius to the distance when the voxel vertex is located on the metaball model.
[0087] After the first position relationship between each voxel vertex and each metaball model is determined, a target edge that intersects with the metaball model may be determined in edges of each voxel based on the first position relationship.
[0088] Specifically, when each edge of the voxel has two voxel vertexes, if one voxel vertex is located inside the metaball model, and the other voxel vertex is located outside the metaball model, it is determined that the edge has an intersection point with the metaball model, and the edge is determined as the target edge.
[0089] After the target edge is determined, position information of a model vertex may be determined based on a distance between a voxel vertex of the target edge (that is, a target voxel vertex) and the metaball model and position coordinate of the target voxel vertex.
[0090] During specific implementation, a field value threshold corresponding to the target voxel vertex may be determined, and then the position coordinate of the target voxel vertex is determined; and afterwards, interpolation calculation is performed on the field value threshold and the position coordinate, to obtain position coordinate of the intersection point, and the position coordinate of the intersection point obtained through interpolation calculation are determined as the position information of the model vertex.
[0091] In this embodiment of the present disclosure, after a plurality of model vertexes are determined, for a single voxel, the model vertexes may be connected in a preset triangular sequence to obtain model meshes, and then models and meshes of all voxels are merged to obtain the target model.
[0092] In the foregoing implementation, in the manner of determining the first position relationship between the voxel vertex and the model unit to determine the target edge that has an intersection point with the model unit and that is in the voxel, the model vertex can be determined more quickly, to meet a time validity requirement of the application.
[0093] In an optional implementation, the foregoing step S9022 of determining a target edge in the voxel based on the first position relationship specifically includes the following steps:
[0094] Step S11: obtaining a target mapping table, the target mapping table is used for representing various position relationships between a voxel vertex for a voxel and each model unit, and an intersection relationship between an edge of the voxel and the model unit.
[0095] Step S12: determining an intersection relationship matching the first position relationship based on the target mapping table.
[0096] Step S13: determining the target edge in the voxel based on a matched intersection relationship.
[0097] In this embodiment of the present disclosure, the target mapping table may be created in advance. The target mapping table includes a plurality of pieces of data. The plurality of pieces of data are used to indicate all position relationships between each voxel vertex and the model unit, and an intersection relationship between each edge and the model unit under each position relationship.
[0098] During specific implementation, eight voxel vertexes of each voxel may be numbered respectively as 1 to 8. There are two position relationships between each voxel vertex and the model unit. That is, the voxel vertex is located inside the model unit and is located outside the model unit. If the voxel vertex is located inside the model unit, 0 is used for representation; or if the voxel vertex is located outside the model unit, 1 is used for representation. At this time, a group of 8-bit data may be used to represent a position relationship between each voxel vertex and the model unit. In other words, the target mapping table includes a plurality of groups of 8-bit data, and the plurality of groups of 8-bit data can enumerate all position relationships between each voxel vertex and the model unit.
[0099] Each group of 8-bit data further corresponds to a group of 12-bit data. The 12-bit data is used to indicate an intersection relationship between each edge of the voxel and the model unit for each group of 8-bit data. Each bit of data in the 12-bit of data is used to indicate an intersection relationship between one edge of the voxel and the model unit. For example, 0 represents no intersection, and 1 represents intersection.
[0100] After the first position relationship between each voxel vertex and each model unit is determined, the target mapping table may be obtained, and target data matching the first position relationship is searched in the plurality of pieces of data in the target mapping table.
[0101] During specific implementation, the first position relationship between the voxel vertex and each model unit may be determined in a numbering sequence of the voxel vertex. If the first position relationship indicates that the voxel vertex is located inside the model unit, 0 is used for representation; or if the first position relationship indicates that the voxel vertex is located outside the model unit, 1 is used for representation. At this time, the first position relationship may be converted into a value represented by 0 or 1, and the value is matched with the plurality of pieces of data in the target mapping table, to obtain the target data matching the value.
[0102] At this time, the intersection relationship in the target data may be determined, and the intersection relationship is determined as the intersection relationship matching the first position relationship. Then, the target edge intersecting with the model unit may be determined in each voxel based on the matching intersection relationship.
[0103] In the foregoing implementation, the target mapping table is created in advance, and in the manner of determining, based on the target mapping table, the target edge that intersects with the model unit and that is in the voxel, a manner of determining the target edge can be simplified, so as to determine, more quickly, an edge that intersects with the model unit and that is in each voxel, thereby meeting a time validity requirement of the application.
[0104] Based on the embodiment shown in FIG. 1, the method provided in this embodiment of the present disclosure further includes the following steps:
[0105] Step S106: determining a vertex normal line of each model vertex of the target model.
[0106] Step S107: determining luminance rendering information of the target model according to the vertex normal line, and performing luminance rendering on the target model based on the luminance rendering information.
[0107] In this embodiment of the present disclosure, to enable a model effect of the target model to be more vivid, model luminance of the target model further needs to be adjusted. Herein, the vertex normal line of each model vertex of the target model may be determined, so as to perform luminance rendering on the target model based on the vertex normal line, thereby obtaining the target model with a more vivid effect.
[0108] In an optional implementation, a normal line of each model mesh of the target model may be determined, so as to determine a normal line of each model vertex based on the normal line of the model mesh.
[0109] During specific implementation, each model mesh of the target model includes three model vertexes, and the three model vertexes may form two vectors. In this case, cross product calculation may be performed on the two vectors, and after normalization processing is performed on a cross product calculation result, a normal line of the model mesh is obtained. For a model vertex adjacent to a plurality of model meshes in the target model, normal lines of the adjacent model meshes may be determined, and normal line interpolation calculation is performed on the normal lines of the adjacent model meshes, to obtain a vertex normal line of the model vertex.
[0110] In another optional implementation, a vertex field value of each model vertex may be further calculated. For example, the vertex field value may be determined based on a distance between the model vertex and a sphere center of a corresponding metaball model. Then, a gradient of the vertex field value may be calculated, to determine, according to the gradient, a direction in which the vertex field value changes most quickly as a normal line direction.
[0111] During specific implementation, the gradient of the vertex field value may be calculated in a manner of performing differential operation on the vertex field value, and then a direction in which the vertex field value changes most quickly may be determined according to a differential operation result, so as to determine the direction as the normal line direction of the model vertex.
[0112] After the vertex normal line is determined, the luminance rendering information of the target model may be determined according to the vertex normal line, so as to perform luminance rendering on the target model based on the luminance rendering information, thereby obtaining an animation model with a more vivid model effect.
[0113] When the model part is a limb model, and when the model skeleton is a limb skeleton, the method provided in this embodiment of the present disclosure further includes the following steps:
[0114] Step S21: determining an extension-retraction distance of the limb model in response to an extension-retraction operation on the limb model in the target model, and adjusting a model quantity of model units in the limb model according to the extension-retraction distance.
[0115] Step S22: determining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model.
[0116] In this embodiment of the present disclosure, after the target model is obtained in the foregoing manner, the user may further perform extension-retraction adjustment on the limb model in the target model. At this time, the extension-retraction operation of the user on the limb model in the target model may be detected, and the extension-retraction type of the extension-retraction operation, for example, limb stretching or limb shortening, is determined in response to the extension-retraction operation. Then, the extension-retraction distance of the limb model, for example, a stretching distance or a shortening distance, may be determined.
[0117] After the extension-retraction distance is determined, the model quantity of model units in the limb model may be adjusted according to the extension-retraction distance. It can be learned through the foregoing description that, the limb skeleton of the limb model is an articulation point of the limb template, and the model unit in the limb model is a metaball model of each articulation point, where one articulation point corresponds to one metaball model. On this basis, a extension-retraction operation may be performed on the limb model, to increase or decrease a quantity of limb skeletons between adjacent articulation points.
[0118] After the quantity of model units of the limb model is adjusted based on the model quantity, the adjusted target model may be determined based on the model gap between adjacent model units obtained after adjustment and the model size of the model unit in the limb model obtained after adjustment.
[0119] In an optional implementation, a ratio may be preset, where the ratio may be understood as a ratio of the extension-retraction distance to the model quantity. For example, the ratio may be set to 1. Then, the model quantity may be adjusted according to the ratio and the extension-retraction distance. For example, if the extension-retraction distance changes to 20 cm, the model quantity is adjusted to 20, where model gaps between adjacent model units are equal.
[0120] During specific implementation, a quantity of metaball models (that is, the model quantity) may be calculated according to the extension-retraction distance, where model gaps between adjacent metaball models are the same (that is, distances between sphere centers of adjacent metaball models are the same). In this case, the model gap between adjacent metaball models is equal to the extension-retraction distance / the model quantity. A muscle morphology can be successfully maintained in this processing manner.
[0121] In an optional implementation, the step of the determining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model specifically further includes the following steps:
[0122] Step S31: determining that a model gap between a first model unit and a second model unit adjacent to the first model unit is a first value in response to determining that the extension-retraction distance does not meet a distance requirement, wherein the first value is an absolute value of a difference between the extension-retraction distance and a second value, the second value is a product between a model quantity of a third model unit and the model gap, and the third model unit is another model unit other than the first model unit.
[0123] Step S32: determining that a model gap between third model units is the model gap, and determining that a model size of the first model unit is the first value.
[0124] In this embodiment of the present disclosure, if it is determined that the ratio between the extension-retraction distance and the model quantity is a decimal, and / or, it is determined that the extension-retraction distance has a decimal place, it is determined that the extension-retraction distance does not meet a distance requirement. At this time, the model gap between the first model unit and the second model unit adjacent to the first model unit may be determined to be the first value. The first model unit may be a model unit corresponding to a limb skeleton that is away from the spine model and that is in the limb model (or, a model unit corresponding to a limb skeleton located on a limb end of the limb model), and the second model unit is a model unit that is adjacent to the first model unit and that is on a side close to the spine model.
[0125] Herein, if a quantity of model units included in the limb model is N, the first model unit may be understood as the last model unit of the limb model, and the third model unit may be understood as a remaining model unit other than the last model unit. At this time, the quantity of third model units is N−1, and the second value is a product between (N−1) and the model gap P:(N−1)*P. If the extension-retraction distance is S, a difference between S and ((N−1)*P) may be calculated, so that an absolute value of the difference is used as the first value. In other words, the model gap between the first model unit and the second model unit is S−((N−1)*P), and a model gap between any adjacent model units in the third model units is P. A jitter generated by the limb model in the extension-retraction process can be alleviated in this processing method, so as to obtain an animation model with better stability.
[0126] A person skilled in the art may understand that, in the foregoing methods of specific implementations, the order in which the steps are written does not means a strict order of execution, and does not constitute any limitation on the implementation process, and the specific order of execution of the steps should be determined by functions and possible internal logic of the steps.
[0127] Based on a same inventive concept, an embodiment of the present disclosure further provides a model generation apparatus corresponding to the model generation method. Because the apparatus in this embodiment of the present disclosure resolves the problem in a principle similar to that of the foregoing model generation method in embodiments of the present disclosure, for the implementation of the apparatus, reference may be made to the implementation of the method, and details are not described again.
[0128] FIG. 10 is a schematic diagram of a model generation apparatus according to an embodiment of the present disclosure. The apparatus includes: an obtaining unit 10, a determining unit 20, a merging unit 30, and a display unit 40.
[0129] The obtaining unit 10 is configured to obtain a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part.
[0130] The determining unit 20 is configured to determine a model unit for each model skeleton of the model part based on the skeleton parameter.
[0131] The merging unit 30 is configured to configured to merge model units of model skeletons, to obtain a target model matching the part morphology.
[0132] The display unit 40 is configured to configured to display the target model on a display interface.
[0133] In this embodiment of the present disclosure, the user may edit a model on an application, and the application may obtain, in response to the model editing operation triggered by the user, the skeleton parameter of each model skeleton of the model part edited by the user. Then, the application may determine a model unit for each model skeleton of the model part based on the skeleton parameter, and merge the model units of the model skeletons, to obtain a target model matching the part morphology, and display the target model on a display interface of the application.
[0134] In the foregoing implementation, the user can edit and create an animation model in the application in a running state, for example, the user can edit and create the animation model in a game program in a running state. In the foregoing processing manner, the user can freely create an expected animation model, to break through limitation in the conventional technology that an artist needs to select in model resources that are preset, so as to meet a plurality of animation design requirements of the user.
[0135] In an optional implementation, the merging unit is further configured to: determine area marking points of a model editing area of the target model; determine model vertexes based on the area marking points and the model units of the model skeletons, and connecting the model vertexes, to obtain a plurality of model meshes; and splice the plurality of model meshes to obtain the target model.
[0136] In a possible implementation, when the area marking points are voxel vertexes of respective voxels in the model editing area, the merging unit is further configured to: determine a first position relationship between each voxel vertex and each model unit, wherein the first position relationship is used for indicating whether the voxel vertex is located inside the model unit; determine a target edge in the voxel based on the first position relationship, wherein the target edge is an edge that is in the voxel and that has an intersection point with the model unit; and determine the model vertexes based on a position coordinate of a target voxel vertex located on the target edge.
[0137] In a possible implementation, the merging unit is further configured to: obtain a target mapping table, the target mapping table is used for representing various position relationships between a voxel vertex for a voxel and each model unit, and an intersection relationship between an edge of the voxel and the model unit; determine an intersection relationship matching the first position relationship based on the target mapping table; and determine the target edge in the voxel based on a matched intersection relationship.
[0138] In a possible implementation, the merging unit is further configured to: determine a vertex normal line of each model vertex of the target model; and determine luminance rendering information of the target model according to the vertex normal line, and perform luminance rendering on the target model based on the luminance rendering information.
[0139] In a possible implementation, the apparatus is further configured to: determine a vertex normal line of each model vertex of the target model; and determine luminance rendering information of the target model according to the vertex normal line, and performing luminance rendering on the target model based on the luminance rendering information.
[0140] In a possible implementation, the obtaining unit is further configured to: a spine skeleton parameter of each spine skeleton of a spine model in response to a first editing operation on the spine model, the spine skeleton parameter is used for indicating a spine morphology of a spine part associated with the spine skeleton; and / or obtain a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model, wherein the limb skeleton parameter is used for indicating a limb morphology of a limb part associated with the limb skeleton.
[0141] In a possible implementation, the obtaining unit is further configured to: obtain a skeleton position parameter of each limb skeleton in response to a position editing operation on the limb skeleton; and / or a muscle morphology parameter of a limb muscle associated with the limb model in response to a muscle editing operation on the limb skeleton, the muscle morphology parameter is used for indicating a model size of a model unit corresponding to each limb skeleton.
[0142] In a possible implementation, the apparatus is further configured to: when the model part is a limb model, and when the model skeleton is a limb skeleton, determine an extension-retraction distance of the limb model in response to an extension-retraction operation on the limb model in the target model, and adjusting a model quantity of model units in the limb model according to the extension-retraction distance; and determine a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model.
[0143] In a possible implementation, the apparatus is further configured to: determine that a model gap between a first model unit and a second model unit adjacent to the first model unit is a first value in response to determining that the extension-retraction distance does not meet a distance requirement, wherein the first value is an absolute value of a difference between the extension-retraction distance and a second value, the second value is a product between a model quantity of a third model unit and the model gap, and the third model unit is another model unit other than the first model unit; and determine that a model gap between third model units is the model gap, and determining that a model size of the first model unit is the first value.
[0144] Reference may be made to related descriptions in the foregoing method embodiment for descriptions of processing procedures of the modules in the apparatus, and procedures of interactions between the modules.
[0145] Corresponding to the model generation method in FIG. 1, an embodiment of the present disclosure further provides an electronic device 1100. FIG. 11 is a schematic structural diagram of an electronic device 1100 according to an embodiment of the present disclosure. The electronic device 1100 includes:
[0146] a processor 111, a memory 112, and a bus 113. The memory 112 is configured to store an execution instruction, and includes an internal memory 1121 and an external memory 1122. The internal memory 1121 herein is also referred to as an internal storage, and is configured to temporarily store operational data in the processor 111, and data exchanged with the external memory 1122 such as a hard disk. The processor 111 exchanges data with the external memory 1122 by using the internal memory 1121. When the electronic device 1100 runs, the processor 111 communicates with the memory 112 through the bus 113, so that the processor 111 executes the following instructions:
[0147] obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part;
[0148] determining a model unit for each model skeleton of the model part based on the skeleton parameter; and
[0149] merging model units of model skeletons, to obtain a target model matching the part morphology, and displaying the target model on a display interface.
[0150] An embodiment of the present disclosure further provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the model generation method in the forgoing method embodiments are performed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0151] It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the system and apparatus described above, reference may be made to a corresponding process in the foregoing method embodiments. Details are not described herein again. In several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in another manner. The apparatus embodiments described above are merely examples. For example, division into the units is merely logic function division and may be other division in actual implementation. For another example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented by using some communication interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
[0152] The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected based on actual requirements to achieve the objectives of the solutions of embodiments.
[0153] In addition, functional units in embodiments of the present disclosure may be integrated into one processing unit, each of the units may exist alone physically, or two or more units are integrated into one unit.
[0154] When the functions are implemented in the form of a software functional unit and sold or used as an independent product, the functions may be stored in a nonvolatile computer-readable storage medium that can be executed by a processor. Based on such an understanding, the technical solutions of the present disclosure essentially, or some of the technical solutions may be implemented in a form of a software product. The software product is stored in a storage medium, and includes several instructions for instructing an electronic device (which may be a personal computer, a server, or a network device) to perform all or some of the steps of the methods described in embodiments of the present disclosure. The foregoing storage medium includes: any medium that can store program code, for example, a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disc.
[0155] Finally, it should be noted that the foregoing embodiments are merely specific implementations of the present disclosure, and are used to describe the technical solutions of the present disclosure, but not to limit the technical solutions of the present disclosure, and the protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the foregoing embodiments, easily figure out changes, or equivalently replace some of the technical features therein within the technical scope disclosed in the present disclosure. However, these modifications, changes, or replacements do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of embodiments of the present disclosure, and should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims
1. A model generation method, comprising:obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part;determining a model unit for each model skeleton of the model part based on the skeleton parameter; andmerging model units of model skeletons, to obtain a target model matching the part morphology, and displaying the target model on a display interface.
2. The method according to claim 1, wherein the merging model units of model skeletons, to obtain a target model matching the part morphology comprises:determining area marking points of a model editing area of the target model;determining model vertexes based on the area marking points and the model units of the model skeletons, and connecting the model vertexes, to obtain a plurality of model meshes; andsplicing the plurality of model meshes to obtain the target model.
3. The method according to claim 2, wherein the area marking points are voxel vertexes of respective voxels in the model editing area; andthe determining model vertexes based on the area marking points and the model units of the model skeletons comprises:determining a first position relationship between each voxel vertex and each model unit, wherein the first position relationship is used for indicating whether the voxel vertex is located inside the model unit;determining a target edge in the voxel based on the first position relationship, wherein the target edge is an edge that is in the voxel and that has an intersection point with the model unit; anddetermining the model vertexes based on a position coordinate of a target voxel vertex located on the target edge.
4. The method according to claim 3, wherein the determining a target edge in the voxel based on the first position relationship comprises:obtaining a target mapping table, wherein the target mapping table is used for representing various position relationships between a voxel vertex for a voxel and each model unit, and an intersection relationship between an edge of the voxel and the model unit;determining an intersection relationship matching the first position relationship based on the target mapping table; anddetermining the target edge in the voxel based on a matched intersection relationship.
5. The method according to claim 3, wherein the determining a first position relationship between each voxel vertex and each model unit comprises:determining distance between each voxel vertex and a model center of each model unit; anddetermining the first position relationship between each voxel vertex and each model unit based on the distance.
6. The method according to claim 1, further comprising:determining a vertex normal line of each model vertex of the target model; anddetermining luminance rendering information of the target model according to the vertex normal line, and performing luminance rendering on the target model based on the luminance rendering information.
7. The method according to claim 1, wherein the obtaininga skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user comprises:obtaining a spine skeleton parameter of each spine skeleton of a spine model in response to a first editing operation on the spine model, wherein the spine skeleton parameter is used for indicating a spine morphology of a spine part associated with the spine skeleton; and / orobtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model, wherein the limb skeleton parameter is used for indicating a limb morphology of a limb part associated with the limb skeleton.
8. The method according to claim 7, wherein the obtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model comprises:obtaining a skeleton position parameter of each limb skeleton in response to a position editing operation on the limb skeleton; and / orobtaining a muscle morphology parameter of a limb muscle associated with the limb model in response to a muscle editing operation on the limb skeleton, wherein the muscle morphology parameter is used for indicating a model size of a model unit corresponding to each limb skeleton.
9. The method according to claim 1, wherein the model part is a limb model, the model skeleton is a limb skeleton, and the method further comprises:determining an extension-retraction distance of the limb model in response to an extension-retraction operation on the limb model in the target model, and adjusting a model quantity of model units in the limb model according to the extension-retraction distance; anddetermining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model.
10. The method according to claim 9, wherein the determining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model comprises:determining that a model gap between a first model unit and a second model unit adjacent to the first model unit is a first value in response to determining that the extension-retraction distance does not meet a distance requirement, wherein the first value is an absolute value of a difference between the extension-retraction distance and a second value, the second value is a product between a model quantity of a third model unit and the model gap, and the third model unit is another model unit other than the first model unit; anddetermining that a model gap between third model units is the model gap, and determining that a model size of the first model unit is the first value.
11. (canceled)12. An electronic device, comprising: a processor, a memory, and a bus, wherein the memory stores a machine-readable instruction executable by the processor, and when the electronic device runs, the processor communicates with the memory via the bus, and when the machine-readable instruction is executed by the processor, a model generation method is performed, and the method comprises:obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part;determining a model unit for each model skeleton of the model part based on the skeleton parameter; andmerging model units of model skeletons, to obtain a target model matching the part morphology, and displaying the target model on a display interface.
13. A non-transitory computer-readable storage medium, storing a computer program, wherein when the computer program is executed by a processor, a model generation method is performed, and the method comprises:obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user, wherein the skeleton parameter is used for indicating a part morphology of the model part;determining a model unit for each model skeleton of the model part based on the skeleton parameter; andmerging model units of model skeletons, to obtain a target model matching the part morphology, and displaying the target model on a display interface.
14. The electronic device according to claim 12, wherein the merging model units of model skeletons, to obtain a target model matching the part morphology comprises:determining area marking points of a model editing area of the target model;determining model vertexes based on the area marking points and the model units of the model skeletons, and connecting the model vertexes, to obtain a plurality of model meshes; andsplicing the plurality of model meshes to obtain the target model.
15. The electronic device according to claim 14, wherein the area marking points are voxel vertexes of respective voxels in the model editing area; andthe determining model vertexes based on the area marking points and the model units of the model skeletons comprises:determining a first position relationship between each voxel vertex and each model unit, wherein the first position relationship is used for indicating whether the voxel vertex is located inside the model unit;determining a target edge in the voxel based on the first position relationship, wherein the target edge is an edge that is in the voxel and that has an intersection point with the model unit; anddetermining the model vertexes based on a position coordinate of a target voxel vertex located on the target edge.
16. The electronic device according to claim 15, wherein the determining a target edge in the voxel based on the first position relationship comprises:obtaining a target mapping table, wherein the target mapping table is used for representing various position relationships between a voxel vertex for a voxel and each model unit, and an intersection relationship between an edge of the voxel and the model unit;determining an intersection relationship matching the first position relationship based on the target mapping table; anddetermining the target edge in the voxel based on a matched intersection relationship.
17. The electronic device according to claim 15, wherein the determining a first position relationship between each voxel vertex and each model unit comprises:determining distance between each voxel vertex and a model center of each model unit; anddetermining the first position relationship between each voxel vertex and each model unit based on the distance.
18. The electronic device according to claim 12, wherein the method further comprises:determining a vertex normal line of each model vertex of the target model; anddetermining luminance rendering information of the target model according to the vertex normal line, and performing luminance rendering on the target model based on the luminance rendering information.
19. The electronic device according to claim 12, wherein the obtaining a skeleton parameter of each model skeleton of a model part that is edited in response to a model editing operation of a user comprises:obtaining a spine skeleton parameter of each spine skeleton of a spine model in response to a first editing operation on the spine model, wherein the spine skeleton parameter is used for indicating a spine morphology of a spine part associated with the spine skeleton; and / orobtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model, wherein the limb skeleton parameter is used for indicating a limb morphology of a limb part associated with the limb skeleton.
20. The electronic device according to claim 19, wherein the obtaining a limb skeleton parameter of each limb skeleton of a limb model in response to a second editing operation on the limb model comprises:obtaining a skeleton position parameter of each limb skeleton in response to a position editing operation on the limb skeleton; and / orobtaining a muscle morphology parameter of a limb muscle associated with the limb model in response to a muscle editing operation on the limb skeleton, wherein the muscle morphology parameter is used for indicating a model size of a model unit corresponding to each limb skeleton.
21. The electronic device according to claim 12, wherein the model part is a limb model, the model skeleton is a limb skeleton, and the method further comprises:determining an extension-retraction distance of the limb model in response to an extension-retraction operation on the limb model in the target model, and adjusting a model quantity of model units in the limb model according to the extension-retraction distance; anddetermining a model gap between adjacent model units in the limb model that is adjusted and a model size of a model unit in the limb model that is adjusted, to obtain an adjusted target model.
