Attachment model adaptation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211291031.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2042-10-21
AI Technical Summary
Existing accessory adaptation methods have poor compatibility between different characters, resulting in accessories looking out of place on the characters and potentially affecting the game's visual effects or increasing production costs.
By determining the body shape feature difference parameters between the target main body model and the baseline main body model, the scaling factor and vertex weight of the target attachment model are calculated, and fine scaling is performed to adapt to different main body models.
The system improved the compatibility of the attachment model with different main models, without losing design features, reducing game production costs and improving performance.
Smart Images

Figure CN115797166B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an adapter method, apparatus, electronic device, and storage medium for an accessory model. Background Technology
[0002] In online virtual games, the same accessory can often be transferred between different characters, such as weapons, clothing, and accessories. The same weapon can be transferred between different characters, and the same outfit or accessory can also be transferred between different characters. However, different characters often have different body shapes, and if the accessories are not size-adapted, it will cause the accessories to look out of place on different characters.
[0003] Existing adaptation methods typically involve simply calculating the adaptation ratio based on the overall proportions of the character, or creating accessories of different sizes for different characters. The former, through simple scaling, easily loses the design features of the accessories, affecting the game's visual appeal. The latter, while increasing game production costs, also negatively impacts game performance. Clearly, existing adaptation technologies suffer from poor adaptation results. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide an accessory model adaptation method, apparatus, electronic device and storage medium to improve the accessory adaptation effect.
[0005] In a first aspect, embodiments of the present invention provide an adaptation method for an attachment model, the method comprising: determining multiple body shape feature difference parameters between a target body model and a preset reference body model; the individual body shape feature difference parameters being used to indicate the scaling factor of the target attachment model along the corresponding axis; determining the scaling weight of each vertex in the target attachment model; and scaling the target attachment model attached to the target body model based on the scaling factor along the corresponding axis and the scaling weight of each vertex.
[0006] Secondly, embodiments of the present invention provide an adapter for an attachment model. The adapter includes: a first determining module, configured to determine multiple body shape feature difference parameters between a target body model and a preset reference body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; a second determining module, configured to determine the scaling weight of each vertex in the target attachment model; and a model scaling module, configured to scale the target attachment model attached to the target body model based on the scaling factor along the corresponding axis and the scaling weight of each vertex.
[0007] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the adaptation method of the above-mentioned appendix model.
[0008] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the adaptation method of the above-mentioned appendix model.
[0009] The embodiments of the present invention bring the following beneficial effects: The aforementioned method, apparatus, electronic device, and storage medium for adapting attachment models determine multiple body shape feature difference parameters between the target main body model and a preset reference main body model. Each body shape feature difference parameter indicates the scaling factor of the target attachment model along the corresponding axis. The scaling weight of each vertex in the target attachment model is determined. Based on the scaling factor along the corresponding axis and the scaling weight of each vertex, the target attachment model attached to the target main body model is scaled. In this method, by using the difference parameters of different body shape features between the target main body model and the reference main body model, the scaling factor of the target attachment model along different axes is determined. Then, combined with the design characteristics of the target attachment model, the scaling weight of each vertex of the target attachment model is determined. The target attachment model attached to the target main body model is then scaled, ensuring that the scaling of the attachment model can incorporate the body shape features of different main body models without losing the design characteristics of the attachment model, thus improving the adaptation effect of the attachment.
[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 This is a flowchart of one embodiment of the attachment model adaptation method in this invention. Figure 2 This is a flowchart of another embodiment of the method for adapting the attachment model in this invention; Figure 3 This is an example diagram of the adaptation method for the attachment model in an embodiment of the present invention; Figure 4 A schematic diagram of an adapter device for an accessory model provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0015] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0016] In one embodiment of the present invention, the attachment model adaptation method can run on an attachment model adaptation device, a local terminal device, or a server. When the attachment model adaptation method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0017] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separate. The storage and execution of the attachment model adaptation method are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.
[0018] In an optional implementation, taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally by downloading, installing, and running the game program via an electronic device. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device can include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.
[0019] In one possible implementation, this embodiment of the invention provides an adaptation method for an attachment model, which provides a graphical user interface through a terminal device, wherein the terminal device can be the aforementioned local terminal device or a client device in the aforementioned cloud interaction system.
[0020] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the attachment model adaptation method in this invention includes: Step S10: Determine multiple body shape feature difference parameters between the target body model and the preset benchmark body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; It should be noted that the target subject model and the preset benchmark subject model have the same model structure, such as both being human models, the same animal model, or the same type of virtual character model, etc. Specific limitations are not specified here. Body shape feature difference parameters are used to indicate the differences in body shape features between the target subject model and the benchmark subject model. Multiple body shape feature difference parameters between the target subject model and the benchmark subject model include difference parameters corresponding to multiple body shape features, such as the first difference parameter corresponding to the first body shape feature, the second difference parameter corresponding to the second body shape feature, and the third difference parameter corresponding to the third body shape feature, etc. Assuming the target subject model is a human model, then the first body shape feature could be height, the second body shape feature could be upper and lower body proportions, and the third body shape feature could be shoulder width, etc. Specific limitations are not specified here. It is understood that each body shape feature difference parameter corresponds to at least one scaling factor along a specific axis. For example, the first body shape feature difference parameter corresponds to the scaling factor along the X-axis, the second body shape feature difference parameter corresponds to the scaling factor along the Y-axis, the third body shape feature difference parameter corresponds to the scaling factors along both the X and Z axes, or the fourth body shape feature difference parameter corresponds to the scaling factors along the X, Y, and Z axes, etc. The specific correspondence between body shape feature difference parameters and axes is not limited here. Because there is a correspondence between body shape feature difference parameters and axes, the more body shape feature difference parameters there are, the more precise the scaling control of the target attachment model can be. It is possible to set different scaling factors along different axes based on different body shape features, resulting in a better scaling effect for the attachment model.
[0021] Understandably, body shape feature difference parameters refer to parameters that can reflect the differences in body shape characteristics between different subject models (including target subject models and baseline subject models). They are used to indicate the differences in body shape features between the target subject model and the baseline subject model. Taking the human body model as an example, the body shape features of the human body model can be height, upper and lower body ratio, shoulder width, and waist-to-shoulder ratio, etc. Then, the corresponding body shape feature difference parameters are height difference parameters, upper and lower body ratio difference parameters, shoulder width difference parameters, and waist-to-shoulder ratio difference parameters, etc.
[0022] In one embodiment, each body shape feature difference parameter corresponds to a scaling factor along one axis. For example, the first body shape feature difference parameter corresponds to a scaling factor along the X-axis, the second body shape feature difference parameter corresponds to a scaling factor along the Y-axis, and the third body shape feature difference parameter corresponds to a scaling factor along the Z-axis. Specifically, for example, the height difference parameter can correspond to a scaling factor along the Z-axis, and the shoulder width difference parameter can correspond to a scaling factor along the X-axis or the Y-axis. In another embodiment, each body shape feature difference parameter may also correspond to at least one scaling factor along one axis. For example, the first body shape feature difference parameter corresponds to scaling factors along the X, Y, and Z axes, the second body shape feature difference parameter corresponds to a scaling factor along the Y-axis, and the third body shape feature difference parameter corresponds to scaling factors along the X and Z axes, etc., and the specific details are not limited here.
[0023] In one implementation, the body shape feature difference parameter can be either a parameter representing the proportion of difference or a parameter representing the numerical value of difference. If the body shape feature difference parameter represents the numerical value of difference, then after determining multiple body shape feature difference parameters between the target subject model and the preset reference subject model, the process further includes: calculating the proportion of difference for each body shape feature difference parameter to obtain the scaling factor for the axis corresponding to each body shape feature difference parameter. For example, assuming the height feature parameter of the reference subject model is 180cm and the height feature parameter of the target subject model is 190cm, if the body shape feature difference parameter represents the numerical value of difference, then the height difference parameter can be 190-180=10. Calculating the proportion of difference for this height difference parameter can be 1-10 / 190=94.7% or 1+10 / 190=105.3%, thus obtaining the scaling factor used to reflect the proportion of height feature difference between the target subject model and the reference subject model.
[0024] Step S20: Determine the scaling weights of each vertex in the target attachment model; As we can understand, scaling weights are used to indicate the degree of scaling of each vertex along each axis. For example, when a vertex's scaling weight is 0, it means that the scaling of each axis of that vertex is 0, i.e., no scaling. When a vertex's scaling weight is 1, it means that the scaling of each axis of that vertex is 1, i.e., fully scaled according to the scaling factor. When a vertex's scaling weight is between 0 and 1, it means that the scaling of each axis of that vertex is also between 0 and 1, i.e., partially scaled. By setting different scaling weights for different vertices, we can use the vertex as the smallest unit of scaling control, making scaling control more precise and improving the adaptation effect of attachments.
[0025] In one implementation, the scaling weights of each vertex in the target attachment model can be pre-set. During model creation, the scaling weights of each vertex can be set based on the design characteristics of the target attachment model, and stored in the target attachment model or attached to the target attachment model after the main target model through vertex attributes. For example, different characters in a virtual game can often use the same prop. The design feature of a spiked club prop might be the spikes at the head. In this case, the creator can set the scaling weight of the spike vertices in the club attachment model to no scaling, which can preserve the design of the spikes to the greatest extent and make the attachment fit better.
[0026] In one implementation, the scaling weights of each vertex in the target attachment model can also be automatically generated. Different weight calculation algorithms can be pre-determined based on the design characteristics of different attachment models. When determining the scaling weights of each vertex in the target attachment model, the scaling weights of each vertex in the target attachment model are calculated according to the corresponding weight calculation algorithm. For example, for some decorative attachment models, such as necklace attachment models, the design feature may be in the pendant part. Therefore, the weight calculation algorithm can be determined as follows: the scaling weight of the vertices in the pendant part is no scaling, and the scaling weight of the vertices in the chain part is full scaling. In this way, the design features of the pendant part will not be lost due to adaptation, and the adaptation effect of the attachment is improved.
[0027] In one implementation, the scaling weights of each vertex in the target attachment model can be determined through a combination of automatic generation and software adjustment. When determining the scaling weights of each vertex in the target attachment model, the initial scaling weights of each vertex are first determined according to the weight calculation algorithm corresponding to the target attachment model. Then, the initial scaling weights are adjusted to determine the target scaling weights of each vertex in the target attachment model. This method can maximize the integration of the attachment model's design characteristics and precisely control its scaling, thereby improving the adaptation effect of the attachment model.
[0028] Step S30: Based on the scaling factor of the corresponding axis and the scaling weight of each vertex, scale the target attachment model attached to the target main model.
[0029] Understandably, the file contains only one target attachment model. When the target attachment model is attached to different target main models, the target attachment model attached to the target main model is scaled according to multiple body feature difference parameters between different target main models and the base main model, as well as the scaling weight of each vertex in the target attachment model. That is, different target attachment models have different body feature difference parameters. When the same target attachment model is attached to different target attachment models, the scaling weight of each vertex in the target attachment model remains unchanged. By using multiple body feature difference parameters and the scaling weight of each vertex, it is possible to control the scaling effect of attaching a target attachment model to different target main models, thereby improving the adaptation effect.
[0030] It should be noted that multiple body shape feature difference parameters can be pre-stored in the configuration file of the target main model, and the scaling weights of each vertex in the target attachment model can be pre-stored in the vertex attributes of the target attachment model. Based on this, the attachment model can be attached to the target main model during rendering, in DCC (Digital Content Creation) software, or in a game engine. In other words, the target attachment model can be scaled during rendering, in the creation software, or in the game engine. The specifics are not limited here.
[0031] In one implementation, since the scaling factor for each axis is applied to the target attachment model as a whole, that is, all vertices are scaled according to the scaling factor for the corresponding axis, step S30 includes: multiplying the coordinate value of each vertex in the target attachment model for the corresponding axis with the scaling factor of the corresponding axis and the scaling weight of the corresponding vertex to obtain the scaled target attachment model attached to the target main model. For example, suppose a vertex has X, Y, Z coordinates of (2.1, 3.2, 7.4), a scaling factor of 1.1 for the X-axis, 0.9 for the Y-axis, and 0.5 for the Z-axis, with a scaling weight of 0.8. Then, the scaled X-axis coordinates of this vertex are: 2.1 × 1.1 × 0.8 = 1.848, the scaled Y-axis coordinates are: 3.2 × 0.9 × 0.8 = 2.304, and the scaled Z-axis coordinates are: 7.4 × 0.5 × 0.8 = 2.96. The scaled coordinates of this vertex are (1.848, 2.304, 2.96). The specific values are not limited here.
[0032] The above-described method for adapting attachment models determines the scaling coefficients of the target attachment model along different axes by using the difference parameters of different body features between the target main model and the reference main model. Then, it determines the scaling weights of each vertex of the target attachment model based on the design features of the target attachment model. The target attachment model attached to the target main model is then scaled, so that the scaling of the attachment model can take into account the body features of different main models without losing the design features of the attachment model, thus improving the adaptation effect of the attachment.
[0033] Please see Figure 2 Another embodiment of the attachment model adaptation method in this invention includes: Step S201: Determine multiple body shape feature difference parameters between the target body model and the preset benchmark body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; Specifically, step S201 includes: obtaining multiple baseline parameters corresponding to a preset baseline subject model; each baseline parameter corresponding to a body shape feature; calculating the parameters of the body shape feature of the target subject model to obtain multiple target parameters corresponding to the target subject model; each target parameter corresponding to a body shape feature; calculating the ratio of the parameters of the corresponding body shape features to the multiple baseline parameters and multiple target parameters to obtain multiple body shape feature difference parameters between the target subject model and the baseline subject model. It can be understood that the multiple baseline parameters corresponding to the baseline subject model are pre-calculated and can be directly obtained, while the target parameters corresponding to each body shape feature of the target subject model need to be calculated. In one embodiment, according to the parameter algorithm corresponding to each body shape feature, the parameters of each body shape feature of the target subject model are calculated to obtain multiple target parameters corresponding to the target subject model. The baseline parameters and target parameters correspond one-to-one, that is, the same body shape feature corresponds to one baseline parameter and one target parameter. Finally, the ratio of the baseline parameters and target parameters corresponding to each body shape feature is calculated to obtain multiple body shape feature difference parameters between the target subject model and the baseline subject model. For example, if a body shape feature is height, then the baseline subject model has a corresponding height baseline parameter, let's say 160cm. By calculating the height feature parameter of the target subject model, we can obtain the target height parameter of the target subject model, let's say 180cm. Then, the parameter ratio of this height feature can be calculated as 180 / 160, resulting in a height feature difference parameter of 112.5%. The specific value is not limited here.
[0034] It is understandable that different body shape features correspond to different parameter calculation methods, including but not limited to calculating parameters for different body shape features based on vertex positions, distances between vertices, number of vertices, positions of model edges, lengths of model edges, distances between model edges, or the area enclosed by model edges. As an example, and not a limitation, implementation method is as follows: the above-mentioned calculation of body shape features of the target body model to obtain multiple target parameters corresponding to the target body model includes: calculating the parameters of the first body shape feature of the target body model based on the distance between the first and second vertices in the target body model to obtain the first parameter corresponding to the target body model; calculating the parameters of the second body shape feature of the target body model based on the position of the first model edge in the target body model to obtain the second parameter corresponding to the target body model; calculating the parameters of the third body shape feature of the target body model based on the lengths of the second and third model edges in the target body model to obtain the third parameter corresponding to the target body model; and combining the first parameter, the first parameter, and the first parameter to obtain multiple target parameters corresponding to the target body model.
[0035] In this embodiment, both the first vertex and the second vertex are feature vertices, both conforming to preset vertex conditions. For example, the first vertex is used to indicate the maximum value vertex of the target body model, and the second vertex is used to indicate the minimum value vertex of the target body model; or the first vertex is located at the highest point of the target body model, and the second vertex is located at the lowest point of the target body model, etc. Through the feature vertices, parameters of the first body shape feature can be calculated. For example, based on the highest and lowest points, parameters of the height feature can be calculated, and the first parameter corresponding to the target body model is the height feature parameter. Similarly, the first, second, and third model edges are all feature model edges, each conforming to its corresponding preset model edge conditions. For example, assuming the target subject model is a human body model, the first model edge can be either the "waistline" or the "neck dividing line" of the human body model; the specific choice is not limited here. If the first model edge is the "waistline," then based on the proportion of the "waistline" to the entire human body model, the body shape feature of the upper and lower body proportions of the human body model can be calculated, resulting in the second parameter corresponding to the target subject model as the upper and lower body proportion feature parameter. Similarly, if the first model edge is the "neck dividing line," then based on the proportion of the "neck dividing line" to the entire human body model, the body shape feature of the head-to-body ratio of the human body model can be calculated, resulting in the second parameter corresponding to the target subject model as the head-to-body ratio feature parameter. The length of the model edge can reflect the size of the model cross section. By calculating the ratio of the length of the second model edge to the length of the second model edge, we can reflect the proportion of the model cross section size. For example, assuming the target body model is a human body model, the second model edge is the "waistline" of the human body model, and the third model edge is the "shoulder line" of the human body model. Then, by dividing the length of the "waistline" by the length of the "shoulder line", we can calculate the body shape feature of the human body model's "waist-to-shoulder ratio". The third parameter corresponding to the target body model is the waist-to-shoulder ratio feature parameter. The specifics are not limited here.
[0036] In one implementation, after step S201, the method further includes storing multiple body shape feature difference parameters in the configuration file of the target main model. It is understood that, to facilitate scaling of the target accessory model across different target main models, storing multiple body shape feature difference parameters in the configuration file of the target main model allows for direct scaling calculations when the target main model is attached to and rendered with the target accessory model. This eliminates the need for calculations during attachment or rendering, improving the efficiency of attachment or rendering and resulting in better adaptation of the accessory model. For example, in a game engine, if a second character model "picks up" a target accessory model "discarded" by a first character model, then when the second character model "wears" the target accessory model, it directly reads multiple body shape feature difference parameters from its own character model's configuration file to perform scaling calculations on the target accessory model, ensuring that the target accessory model is the appropriate size when "wearing" the second character model.
[0037] Step S202: Determine the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point in the target attachment model; the attachment point is used to indicate the connection vertex of the target attachment model to the target main model. As can be understood, a connection point is the vertex connecting the target accessory model to the target main model. There can be one or more connection vertices; this is not limited here. Therefore, a connection vertex is a vertex in both the target accessory model and the target main model. For example, in a virtual game, the target accessory model of a weapon or prop is usually held by the target main model of the virtual character. In this case, the vertex of the held portion is the connection point. For the target accessory model of a weapon or prop, the connection point of the held portion could be the handle of the weapon or prop; for the target main model of a virtual character, the connection point of the held portion could be the palm of the virtual character. This is not further limited here. In this step, the scaling weight of each vertex in the target attachment model is determined based on the distance between each vertex and the connecting vertices. When there are two or more attachment points, a target attachment point can be selected from all attachment points according to preset attachment point selection rules. For example, a target attachment point can be randomly selected from all attachment points, a center point can be selected from all attachment points, or the target attachment point closest to the center vertex of the target attachment model can be selected. Specific selection methods are not limited here. When there are two or more attachment points, a target attachment point can also be obtained by calculating all attachment points according to preset attachment point algorithms. For example, the minimum or maximum attachment point among all attachment points can be calculated to obtain the target attachment point. Specific calculation methods are not limited here. The target attachment point is used to determine the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the target attachment point.
[0038] In this step, after determining the distances between each vertex and the attachment point in the target attachment model, the scaling weight of each vertex in the target attachment model can be determined based on the distance between each vertex and the attachment point using a preset weight calculation formula. For example, the larger the distance between the vertex and the attachment point, the larger the scaling weight, or the distance can conform to a weight calculation formula based on a quadratic equation. Alternatively, the scaling weight of vertices within different ranges can be determined by defining vertex ranges, or different scaling weight calculation methods can be applied to vertices within different ranges. For example, multiple vertex distance ranges can be defined, with each vertex within a range corresponding to a scaling weight. Other scaling weight determination methods can also be used based on the design characteristics of the attachment model and the shape features of the target main model. For example, for the target attachment model of a necklace, the scaling weight of the vertices in the pendant section is no scaling, while the scaling weight of the vertices in the chain section is fully scaled; specific limitations are not specified here.
[0039] In one implementation, the scaling weight of each vertex in the target attachment model can be determined by the distance between each vertex and the attachment point. Specifically, step S202 includes the following steps: (1) Calculate the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model; (2) Calculate the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; (3) Calculate the ratio between the first distance and the longest distance corresponding to each vertex to obtain the scaling weight of each vertex in the target attachment model.
[0040] It is understandable that special scaling weights are often required at the visual intersection of some accessory models and the main model. For example, in virtual games, the visual intersection of the target accessory model of a weapon prop and the target main model of a virtual character is usually the handheld part. The size of this part usually does not change much with the differences in the body shape of the target main model. Therefore, the scaling weight of this part of the vertices can be determined as no scaling. In this embodiment, the scaling weights of vertices that require special processing and those that do not are determined by the distance between each vertex and the attachment point. Specifically, the distance is judged by the longest distance. First, the bounding box of the target accessory model is constructed, and the longest distance is calculated for the bounding box. The longest distance between each vertex in the target accessory model is then calculated. The first distance between each vertex and the attachment point is divided by the longest distance to obtain the proportion of the first distance to the longest distance for each vertex. The larger the proportion, the farther the vertex is from the attachment point; the smaller the proportion, the closer the vertex is to the attachment point. In one implementation, the ratio of the first distance to the longest distance corresponding to each vertex is determined as the scaling weight of the corresponding vertex in the target attachment model. For example, if the first distance of a vertex is 30cm and the longest distance is 60cm, then the scaling weight of that vertex is 30 / 60=0.5.
[0041] Furthermore, step (1) above includes: calculating the minimum and maximum vertices in the target attachment model using the bounding rectangle of the target attachment model; calculating the Euclidean distance between the minimum and maximum vertices to obtain the longest distance between all vertices in the target attachment model. In this embodiment, the minimum and maximum vertices of the target attachment model can be calculated based on the coordinate system of the bounding rectangle, and then the Euclidean distance between the maximum and minimum vertices can be calculated using the Euclidean distance calculation formula to obtain the longest distance between all vertices in the target attachment model.
[0042] Furthermore, step (2) above includes: if there are multiple attachment points of the target attachment model to the target main model, then the average value of each attachment point is calculated to obtain the target attachment point; the distance between each vertex in the target attachment model and the target attachment point is calculated to obtain the first distance corresponding to each vertex. In this embodiment, to more accurately determine the target attachment point among multiple attachment points for vertex distance calculation, when there are multiple attachment points for the target attachment model to the target main model, the average coordinate values of each attachment point are calculated to obtain the target attachment point. For example, if the coordinate values of the multiple attachment points are attachment point A (2,2,2), attachment point B (6,10,40), attachment point C (6,8,10), and attachment point D (4,4,10), then the coordinate values of the target attachment point are (2+6+6+4) / 4=4.5, (2+10+8+4) / 4=6, and (2+40+10+10) / 4=15.5, respectively. Therefore, the target attachment point is (4.5,6,15.5). The distance between the target attachment point and each vertex is calculated based on this distance to obtain the first distance corresponding to each vertex.
[0043] In one embodiment, step S202 further includes: calculating the distance between each vertex and the attachment point in the target attachment model to obtain a first distance corresponding to each vertex; if the first distance is less than a first preset distance threshold, then determining a first scaling weight for the corresponding vertex; if the first distance is greater than or equal to the first preset distance threshold and less than a second preset distance threshold, then calculating a second scaling weight for the corresponding vertex based on the first distance; if the first distance is greater than or equal to the second preset distance threshold, then determining a third scaling weight for the corresponding vertex. This embodiment sets different scaling weights for vertices at different distances by setting different distance thresholds. The first preset distance threshold is less than the second preset distance threshold. Assuming the first preset distance threshold is... The second preset distance threshold is , No. vertices Let the first distance be d, then when When that happens, the vertex is determined. The scaling weight is the first scaling weight, when At that time, based on the vertex The corresponding d is used to calculate the vertex. The scaling weights are used to obtain the vertex. The second scaling weight can be different or the same for different vertices; there is no specific limitation here. However, when... When that happens, the vertex is determined. The scaling weight is the third scaling weight. Similarly, a third preset distance threshold, a fourth preset distance threshold, a fifth preset distance threshold, etc., can be set to define the scaling weight corresponding to vertices at different distances, depending on the design features of the attachment model and the size characteristics of the main model.
[0044] In this embodiment, for vertices within a certain distance range, in addition to setting the same scaling weight for all vertices within that distance range, a preset scaling weight calculation method can also be used to calculate the scaling weight for the vertices within that distance range, as described above. vertex The vertex can be determined through the above steps (1)-(3). The scaling weight of a vertex can also be determined using other scaling weight calculation formulas and algorithms. The scaling weights are used to obtain the values of each vertex. The corresponding second scaling weight.
[0045] In one implementation, since the scaling weights of each vertex in the target attachment model can reflect the design characteristics of the target attachment model to a certain extent, the scaling weights can be embedded in the vertex attributes of the target attachment model. When scaling is required, the scaling weights in the vertex attributes can be read directly. The vertex attributes can be custom vertex attributes or vertex color attributes. Specifically, after step S202 and before step S203, the method further includes: storing the scaling weights of each vertex in the target attachment model into the vertex color attributes of the corresponding vertex. The vertex color attributes can be attributes of color channels, such as any color channel attribute in the RGBA color channel, or grayscale attributes, transparency attributes, etc. In one implementation, storing the scaling weights of each vertex in the target attachment model into the vertex color attributes of the corresponding vertex includes: converting the scaling weights of each vertex in the target attachment model into preset vertex color attribute values, and storing each vertex color attribute value into the vertex color attributes of the corresponding vertex. Taking the grayscale attribute in the vertex color attributes as an example, the grayscale distribution of a weapon prop's target attachment model is as follows: Figure 3 As shown, the grayscale value of the black part is 0, which represents a scaling weight of 0; the grayscale value of the gray part is between 0 and 1, which represents a scaling weight between 0 and 1; and the grayscale value of the white part is 1, which represents a scaling weight of 1.
[0046] Step S203: Based on the scaling factor of the corresponding axis and the scaling weight of each vertex, scale the target attachment model attached to the target main model.
[0047] In this step, after determining the scaling factors for each axis and the scaling weights for each vertex, the target attachment model attached to the target main model can be scaled. This eliminates the need to repeatedly create size-adapted attachment models; a single target attachment model is sufficient to achieve scaling and adaptation across different main models. This saves memory, improves rendering performance, and reduces loading time, resulting in better adaptation. It can be understood that the original size of the target attachment model is based on the body shape characteristics of the baseline main model, possessing a baseline size. During attachment model adaptation, the original size of the target attachment model is scaled based on the scaling factors for the corresponding axes and the scaling weights for each vertex, thus ensuring that the target attachment model attached to the target main model has a size that adapts to the corresponding main model.
[0048] In one embodiment, step S203 includes: reading the coordinates of each vertex in the target attachment model, and multiplying the coordinates of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex to scale the target attachment model attached to the target main model. It can be understood that, in order to combine the body shape characteristics of the main model and the design features of the attachment model, this embodiment multiplies the coordinate values of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex to obtain the final scaled coordinate values, thereby achieving the scaling of the target attachment model attached to the target main model. For example, suppose a vertex has X, Y, Z coordinates of (2, 3, 7), and the scaling factor for the X-axis is 1.1, the scaling factor for the Y-axis is 0.9, the scaling factor for the Z-axis is 0.5, and the scaling weight of the vertex is 0.8. Then, the scaled X-axis coordinates of the vertex are: 2 × 1.1 × 0.8 = 1.76, the scaled Y-axis coordinates are: 3 × 0.9 × 0.8 = 2.16, and the scaled Z-axis coordinates are: 7 × 0.5 × 0.8 = 2.8. The scaled coordinates of the vertex are (1.848, 2.304, 2.96). After rounding the decimals, we can get the scaled coordinates of the vertex as (2, 2, 3). The specific values are not limited here.
[0049] Based on the above, multiplying the coordinates of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex includes: multiplying the coordinate value of the first axis of each vertex by the scaling factor of the corresponding first axis and the scaling weight of the corresponding vertex; the first axis includes at least one axis; multiplying the coordinate value of the second axis of each vertex by the scaling factor of the corresponding second axis and the scaling weight of the corresponding vertex; the second axis includes at least one axis; multiplying the coordinate value of the third axis of each vertex by the scaling factor of the corresponding third axis and the scaling weight of the corresponding vertex; the third axis includes at least one axis; the axes included in the first axis, the second axis, and the third axis are all different. It is understandable that different body shape feature difference parameters correspond to different axes, and different axes correspond to different scaling factors. Each body shape feature difference parameter can correspond to one or more axes. For example, the first body shape feature difference parameter corresponds to a first axis, which includes at least one axis; the second body shape feature difference parameter corresponds to a second axis, which includes at least one axis; and the third body shape feature difference parameter corresponds to a third axis, which includes at least one axis. The axes included in the first, second, and third axes are all different. For example, the first axis includes the XYZ axes, the second axis includes the Y axis, and the third axis includes the XZ axes, etc., depending on the target. The body shape features of the main model, for example, assuming the first body shape feature difference parameter is the height feature difference parameter, then the first axis corresponding to the first body shape feature difference parameter can include the XYZ axes, and the scaling factor corresponding to the first axis represents the overall scaling of the target attachment model. Assuming the second body shape feature difference parameter is the upper and lower body proportion feature difference parameter, then the second axis corresponding to the second body shape feature difference parameter can include the Y axis, and the scaling factor corresponding to the second axis represents scaling only the Y axis of the target attachment model. And so on, according to the characteristics of different body shape feature difference parameters, different scaling factors can be set to scale the target attachment model in different dimensions.
[0050] As an example, and not a limitation, suppose a vertex in the target attachment model has coordinates (2, 4, 5). The first axis includes the X, Y, and Z axes, with a scaling factor of 1.1. The second axis includes the Y axis, with a scaling factor of 0.9. The third axis includes the X and Z axes, with a scaling factor of 1.2. The scaling weight of this vertex is 0.8. Then, the coordinates of this vertex along each axis are: X axis: 2 × 1.1 × 1.2 × 0.8 = 2.112, Y axis: 4 × 1.1 × 0.9 × 0.8 = 3.168, Z axis: 5 × 1.1 × 1.2 × 0.8 = 5.28. That is, the scaled coordinates of this vertex are (2.112, 3.168, 5.28). The decimal part can be removed to get the scaled coordinates of this vertex as (2, 3, 5). The specific values are not limited here.
[0051] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 4 The diagram shows an adapter for an attachment model. The adapter includes: a first determining module 40, used to determine multiple body feature difference parameters between the target body model and a preset reference body model; each body feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; a second determining module 42, used to determine the scaling weight of each vertex in the target attachment model; and a model scaling module 44, used to scale the target attachment model attached to the target body model based on the scaling factor along the corresponding axis and the scaling weight of each vertex.
[0052] The aforementioned adapter for the attachment model determines the scaling factor of the target attachment model along different axes by using the difference parameters of different body features between the target main model and the reference main model. Then, it determines the scaling weight of each vertex of the target attachment model based on the design features of the target attachment model. The target attachment model attached to the target main model is scaled, so that the scaling of the attachment model can take into account the body features of different main models without losing the design features of the attachment model, thus improving the adaptation effect of the attachment.
[0053] The second determining module mentioned above is also used to: determine the scaling weight of each vertex in the target attachment model based on the distance between each vertex in the target attachment model and the attachment point; the attachment point is used to indicate the connection vertex of the target attachment model to the target main model.
[0054] The second determining module is further configured to: calculate the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model; calculate the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; and calculate the ratio between the first distance and the longest distance corresponding to each vertex to obtain the scaling weight of each vertex in the target attachment model.
[0055] The second determining module is further configured to: calculate the minimum and maximum vertices in the target attachment model using the bounding rectangle of the target attachment model; and calculate the Euclidean distance between the minimum and maximum vertices to obtain the longest distance between all vertices in the target attachment model.
[0056] The second determining module is further configured to: if there are multiple attachment points for the target attachment model to the target main model, calculate the average value of each attachment point to obtain the target attachment point; and calculate the distance between each vertex in the target attachment model and the target attachment point to obtain the first distance corresponding to each vertex.
[0057] The second determining module is further configured to: calculate the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; if the first distance is less than a first preset distance threshold, determine the first scaling weight of the corresponding vertex; if the first distance is greater than or equal to the first preset distance threshold and less than the second preset distance threshold, calculate the second scaling weight of the corresponding vertex based on the first distance of the corresponding vertex; if the first distance is greater than or equal to the second preset distance threshold, determine the third scaling weight of the corresponding vertex.
[0058] The aforementioned device further includes: a first storage module, used to: store the scaling weights of each vertex in the target attachment model into the vertex color attribute of the corresponding vertex.
[0059] The aforementioned device further includes: a second storage module, used to: store multiple body shape feature difference parameters into a configuration file of the target subject model.
[0060] The aforementioned first determining module is further configured to: obtain multiple benchmark parameters corresponding to a preset benchmark subject model; each benchmark parameter corresponds to a body shape feature; perform parameter calculation on the body shape feature of the target subject model to obtain multiple target parameters corresponding to the target subject model; each target parameter corresponds to a body shape feature; and calculate the parameter ratio of the corresponding body shape features on the multiple benchmark parameters and the multiple target parameters to obtain multiple body shape feature difference parameters between the target subject model and the benchmark subject model.
[0061] The aforementioned first determining module is further configured to: calculate the parameters of the first body shape feature of the target body model based on the distance between the first vertex and the second vertex in the target body model, to obtain the first parameter corresponding to the target body model; calculate the parameters of the second body shape feature of the target body model based on the position of the first model edge in the target body model, to obtain the second parameter corresponding to the target body model; calculate the parameters of the third body shape feature of the target body model based on the length of the second model edge and the length of the second model edge in the target body model, to obtain the third parameter corresponding to the target body model; and combine the first parameter, the first parameter, and the first parameter to obtain multiple target parameters corresponding to the target body model.
[0062] The aforementioned model scaling module is also used to: read the coordinates of each vertex in the target attachment model, and multiply the coordinates of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex, so as to scale the target attachment model attached to the target main model.
[0063] The aforementioned model scaling module is further configured to: multiply the coordinate value of the first axis of each vertex by the scaling factor of the corresponding first axis and the scaling weight of the corresponding vertex; the first axis includes at least one axis; multiply the coordinate value of the second axis of each vertex by the scaling factor of the corresponding second axis and the scaling weight of the corresponding vertex; the second axis includes at least one axis; multiply the coordinate value of the third axis of each vertex by the scaling factor of the corresponding third axis and the scaling weight of the corresponding vertex; the third axis includes at least one axis; the axes included in the first axis, the second axis, and the third axis are all different.
[0064] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the adaptation method of the above-described appendix model. This electronic device can be a server or a terminal device.
[0065] See Figure 5 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the adaptation method of the above-mentioned accessory model.
[0066] Furthermore, Figure 5 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0067] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0068] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101. The processor 100 reads information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments, for example: Determine multiple body shape feature difference parameters between the target main body model and the preset benchmark main body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; determine the scaling weight of each vertex in the target attachment model; based on the scaling factor of the corresponding axis and the scaling weight of each vertex, scale the target attachment model attached to the target main body model.
[0069] The aforementioned electronic device for adapting the attachment model determines the scaling factor of the target attachment model along different axes by using the difference parameters of different body features between the target main body model and the reference main body model. Then, it determines the scaling weight of each vertex of the target attachment model by combining the design features of the target attachment model. The target attachment model attached to the target main body model is scaled, so that the scaling of the attachment model can combine the body features of different main body models without losing the design features of the attachment model, thus improving the adaptation effect of the attachment.
[0070] The above determination of the scaling weights of each vertex in the target attachment model includes: determining the scaling weights of each vertex in the target attachment model based on the distance between each vertex in the target attachment model and the attachment point; the attachment point is used to indicate the connection vertex of the target attachment model to the target main model.
[0071] The above method for determining the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point includes: calculating the longest distance between each vertex in the target attachment model based on the bounding rectangle of the target attachment model; calculating the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; and calculating the ratio between the first distance and the longest distance corresponding to each vertex to obtain the scaling weight of each vertex in the target attachment model.
[0072] The above calculation of the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model includes: calculating the minimum and maximum value vertices in the target attachment model using the bounding rectangle of the target attachment model; calculating the Euclidean distance between the minimum and maximum value vertices to obtain the longest distance between vertices in the target attachment model.
[0073] The above calculation of the distance between each vertex in the target attachment model and the attachment point to obtain the first distance corresponding to each vertex includes: if there are multiple attachment points between the target attachment model and the target main model, the average value of each attachment point is calculated to obtain the target attachment point; the calculation of the distance between each vertex in the target attachment model and the target attachment point to obtain the first distance corresponding to each vertex.
[0074] The above-mentioned determination of the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point in the target attachment model includes: calculating the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; if the first distance is less than a first preset distance threshold, then the first scaling weight of the corresponding vertex is determined; if the first distance is greater than or equal to the first preset distance threshold and less than a second preset distance threshold, then the second scaling weight of the corresponding vertex is calculated based on the first distance of the corresponding vertex; if the first distance is greater than or equal to the second preset distance threshold, then the third scaling weight of the corresponding vertex is determined.
[0075] The above method also includes storing the scaling weights of each vertex in the target attachment model into the vertex color attribute of the corresponding vertex.
[0076] The above method also includes storing multiple body shape feature difference parameters in the configuration file of the target subject model.
[0077] The above-mentioned determination of multiple body shape feature difference parameters between the target subject model and the preset benchmark subject model includes: obtaining multiple benchmark parameters corresponding to the preset benchmark subject model; each benchmark parameter corresponds to a body shape feature; calculating the parameters of the body shape feature of the target subject model to obtain multiple target parameters corresponding to the target subject model; each target parameter corresponds to a body shape feature; calculating the parameter ratio of the corresponding body shape feature of the multiple benchmark parameters and the multiple target parameters to obtain multiple body shape feature difference parameters between the target subject model and the benchmark subject model.
[0078] The above-mentioned calculation of body shape features of the target subject model yields multiple target parameters corresponding to the target subject model, including: calculating the parameters of the first body shape feature of the target subject model based on the distance between the first vertex and the second vertex in the target subject model, obtaining the first parameter corresponding to the target subject model; calculating the parameters of the second body shape feature of the target subject model based on the position of the first model edge in the target subject model, obtaining the second parameter corresponding to the target subject model; calculating the parameters of the third body shape feature of the target subject model based on the length of the second model edge in the target subject model, obtaining the third parameter corresponding to the target subject model; and combining the first parameter, the first parameter, and the first parameter to obtain multiple target parameters corresponding to the target subject model.
[0079] The above-mentioned scaling of the target attachment model attached to the target main model based on the scaling factor of the corresponding axis and the scaling weight of each vertex includes: reading the coordinates of each vertex in the target attachment model and multiplying the coordinates of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex to scale the target attachment model attached to the target main model.
[0080] The above multiplication of the coordinates of each vertex with the scaling factor of each axis and the scaling weight of the corresponding vertex includes: multiplying the coordinate value of the first axis of each vertex with the scaling factor of the corresponding first axis and the scaling weight of the corresponding vertex; the first axis includes at least one axis; multiplying the coordinate value of the second axis of each vertex with the scaling factor of the corresponding second axis and the scaling weight of the corresponding vertex; the second axis includes at least one axis; multiplying the coordinate value of the third axis of each vertex with the scaling factor of the corresponding third axis and the scaling weight of the corresponding vertex; the third axis includes at least one axis; the axes included in the first axis, the second axis, and the third axis are all different.
[0081] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When these machine-executable instructions are invoked and executed by a processor, they cause the processor to implement the adaptation method of the aforementioned appendix model, for example: Determine multiple body shape feature difference parameters between the target main body model and the preset benchmark main body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; determine the scaling weight of each vertex in the target attachment model; based on the scaling factor of the corresponding axis and the scaling weight of each vertex, scale the target attachment model attached to the target main body model.
[0082] The aforementioned attachment model's adaptation storage medium determines the scaling factor of the target attachment model along different axes by using the difference parameters of different body features between the target main model and the reference main model. Then, combined with the design characteristics of the target attachment model, it determines the scaling weight of each vertex of the target attachment model. The target attachment model attached to the target main model is scaled, so that the scaling of the attachment model can combine the body features of different main models without losing the design features of the attachment model, thus improving the adaptation effect of the attachment.
[0083] The above determination of the scaling weights of each vertex in the target attachment model includes: determining the scaling weights of each vertex in the target attachment model based on the distance between each vertex in the target attachment model and the attachment point; the attachment point is used to indicate the connection vertex of the target attachment model to the target main model.
[0084] The above method for determining the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point includes: calculating the longest distance between each vertex in the target attachment model based on the bounding rectangle of the target attachment model; calculating the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; and calculating the ratio between the first distance and the longest distance corresponding to each vertex to obtain the scaling weight of each vertex in the target attachment model.
[0085] The above calculation of the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model includes: calculating the minimum and maximum value vertices in the target attachment model using the bounding rectangle of the target attachment model; calculating the Euclidean distance between the minimum and maximum value vertices to obtain the longest distance between vertices in the target attachment model.
[0086] The above calculation of the distance between each vertex in the target attachment model and the attachment point to obtain the first distance corresponding to each vertex includes: if there are multiple attachment points between the target attachment model and the target main model, the average value of each attachment point is calculated to obtain the target attachment point; the calculation of the distance between each vertex in the target attachment model and the target attachment point to obtain the first distance corresponding to each vertex.
[0087] The above-mentioned determination of the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point in the target attachment model includes: calculating the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex; if the first distance is less than a first preset distance threshold, then the first scaling weight of the corresponding vertex is determined; if the first distance is greater than or equal to the first preset distance threshold and less than a second preset distance threshold, then the second scaling weight of the corresponding vertex is calculated based on the first distance of the corresponding vertex; if the first distance is greater than or equal to the second preset distance threshold, then the third scaling weight of the corresponding vertex is determined.
[0088] The above method also includes storing the scaling weights of each vertex in the target attachment model into the vertex color attribute of the corresponding vertex.
[0089] The above method also includes storing multiple body shape feature difference parameters in the configuration file of the target subject model.
[0090] The above-mentioned determination of multiple body shape feature difference parameters between the target subject model and the preset benchmark subject model includes: obtaining multiple benchmark parameters corresponding to the preset benchmark subject model; each benchmark parameter corresponds to a body shape feature; calculating the parameters of the body shape feature of the target subject model to obtain multiple target parameters corresponding to the target subject model; each target parameter corresponds to a body shape feature; calculating the parameter ratio of the corresponding body shape feature of the multiple benchmark parameters and the multiple target parameters to obtain multiple body shape feature difference parameters between the target subject model and the benchmark subject model.
[0091] The above-mentioned calculation of body shape features of the target subject model yields multiple target parameters corresponding to the target subject model, including: calculating the parameters of the first body shape feature of the target subject model based on the distance between the first vertex and the second vertex in the target subject model, obtaining the first parameter corresponding to the target subject model; calculating the parameters of the second body shape feature of the target subject model based on the position of the first model edge in the target subject model, obtaining the second parameter corresponding to the target subject model; calculating the parameters of the third body shape feature of the target subject model based on the length of the second model edge in the target subject model, obtaining the third parameter corresponding to the target subject model; and combining the first parameter, the first parameter, and the first parameter to obtain multiple target parameters corresponding to the target subject model.
[0092] The above-mentioned scaling of the target attachment model attached to the target main model based on the scaling factor of the corresponding axis and the scaling weight of each vertex includes: reading the coordinates of each vertex in the target attachment model and multiplying the coordinates of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex to scale the target attachment model attached to the target main model.
[0093] The above multiplication of the coordinates of each vertex with the scaling factor of each axis and the scaling weight of the corresponding vertex includes: multiplying the coordinate value of the first axis of each vertex with the scaling factor of the corresponding first axis and the scaling weight of the corresponding vertex; the first axis includes at least one axis; multiplying the coordinate value of the second axis of each vertex with the scaling factor of the corresponding second axis and the scaling weight of the corresponding vertex; the second axis includes at least one axis; multiplying the coordinate value of the third axis of each vertex with the scaling factor of the corresponding third axis and the scaling weight of the corresponding vertex; the third axis includes at least one axis; the axes included in the first axis, the second axis, and the third axis are all different.
[0094] The computer program product of the adapter method, apparatus, electronic device and storage medium of the accessory model provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0095] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0096] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0097] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0098] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0099] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for adapting an attachment model, characterized in that, The method includes: Determine multiple body shape feature difference parameters between the target main body model and the preset benchmark main body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis; Determine the scaling weights of each vertex in the target attachment model; Based on the scaling factor of the corresponding axis and the scaling weight of each vertex, the target attachment model attached to the target main model is scaled. Determining the scaling weights of each vertex in the target attachment model includes: The scaling weight of each vertex in the target attachment model is determined based on the distance between each vertex and the attachment point in the target attachment model; the attachment point is used to indicate the connection vertex of the target attachment model to the target main model. The step of determining the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point in the target attachment model includes: Calculate the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model; The distance between each vertex and the attachment point in the target attachment model is calculated to obtain the first distance corresponding to each vertex; Calculate the ratio between the first distance and the longest distance corresponding to each vertex to obtain the scaling weight of each vertex in the target attachment model.
2. The method according to claim 1, characterized in that, The step of calculating the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model includes: Calculate the minimum and maximum value vertices in the target attachment model using the bounding rectangle of the target attachment model; The Euclidean distance between the minimum and maximum value vertices is calculated to obtain the longest distance between all vertices in the target attachment model.
3. The method according to claim 1, characterized in that, The calculation of the distance between each vertex and the attachment point in the target attachment model to obtain the first distance corresponding to each vertex includes: If the target attachment model is attached to the target main body model at multiple points, then the average value of each attachment point is calculated to obtain the target attachment point; The distance between each vertex in the target attachment model and the target attachment point is calculated to obtain the first distance corresponding to each vertex.
4. The method according to claim 1, characterized in that, The step of determining the scaling weight of each vertex in the target attachment model based on the distance between each vertex and the attachment point in the target attachment model includes: The distance between each vertex and the attachment point in the target attachment model is calculated to obtain the first distance corresponding to each vertex; If the first distance is less than the first preset distance threshold, then the first scaling weight of the corresponding vertex is determined; If the first distance is greater than or equal to the first preset distance threshold and less than the second preset distance threshold, then the second scaling weight of the corresponding vertex is calculated based on the first distance of the corresponding vertex. If the first distance is greater than or equal to the second preset distance threshold, then the third scaling weight of the corresponding vertex is determined.
5. The method according to claim 1, characterized in that, After determining the scaling weights of each vertex in the target attachment model, and before scaling the target attachment model attached to the target main model based on the scaling coefficients of the corresponding axes and the scaling weights of each vertex, the method further includes: The scaling weights of each vertex in the target attachment model are stored in the vertex color attribute of the corresponding vertex.
6. The method according to claim 1, characterized in that, After determining multiple body shape feature difference parameters between the target main body model and the preset benchmark main body model, and before determining the scaling weights of each vertex in the target attachment model, the method further includes: The multiple body shape feature difference parameters are stored in the configuration file of the target subject model.
7. The method according to claim 1, characterized in that, The determination of multiple body shape feature difference parameters between the target subject model and the preset benchmark subject model includes: Obtain multiple baseline parameters corresponding to the preset baseline main body model; each baseline parameter corresponds to a body shape feature; The body shape features of the target subject model are calculated to obtain multiple target parameters corresponding to the target subject model; each target parameter corresponds to a body shape feature. The parameter ratios of corresponding body shape features are calculated for the multiple benchmark parameters and the multiple target parameters to obtain multiple body shape feature difference parameters between the target body model and the benchmark body model.
8. The method according to claim 7, characterized in that, The calculation of the body shape features of the target subject model yields multiple target parameters corresponding to the target subject model, including: Based on the distance between the first vertex and the second vertex in the target body model, the parameters of the first body shape feature of the target body model are calculated to obtain the first parameter corresponding to the target body model; Based on the location of the first model edge in the target subject model, the parameters of the second body shape feature of the target subject model are calculated to obtain the second parameter corresponding to the target subject model; Based on the length of the second model edge in the target subject model, the parameters of the third body shape feature of the target subject model are calculated to obtain the third parameter corresponding to the target subject model; By combining the first parameter, the first parameter, and the first parameter, multiple target parameters corresponding to the target subject model are obtained.
9. The method according to claim 1, characterized in that, The scaling of the target attachment model attached to the target main model, based on the scaling factor of the corresponding axis and the scaling weight of each vertex, includes: The coordinates of each vertex in the target attachment model are read, and the coordinates of each vertex are multiplied by the scaling factor of each axis and the scaling weight of the corresponding vertex to scale the target attachment model attached to the target main model.
10. The method according to claim 9, characterized in that, The step of multiplying the coordinates of each vertex by the scaling factor of each axis and the scaling weight of the corresponding vertex includes: Multiply the coordinate value of the first axis in the coordinates of each vertex by the scaling factor of the corresponding first axis and the scaling weight of the corresponding vertex; the first axis includes at least one axis. Multiply the coordinate value of the second axis in the coordinates of each vertex by the scaling factor of the corresponding second axis and the scaling weight of the corresponding vertex; the second axis includes at least one axis. The coordinate value of the third axis in the coordinates of each vertex is multiplied by the scaling factor of the corresponding third axis and the scaling weight of the corresponding vertex; the third axis includes at least one axis; the first axis, the second axis and the third axis contain different axes.
11. An adapter for an accessory model, characterized in that, The device includes: The first determining module is used to determine multiple body shape feature difference parameters between the target body model and the preset benchmark body model; each body shape feature difference parameter is used to indicate the scaling factor of the target attachment model along the corresponding axis. The second determining module is used to determine the scaling weights of each vertex in the target attachment model; The model scaling module is used to scale the target attachment model attached to the target main model based on the scaling factor of the corresponding axis and the scaling weight of each vertex. The second determining module is further configured to: determine the scaling weight of each vertex in the target attachment model based on the distance between each vertex in the target attachment model and the attachment point; the attachment point is used to indicate the connection vertex of the target attachment model to the target main model; The second determining module is further configured to: Calculate the longest distance between vertices in the target attachment model based on the bounding rectangle of the target attachment model; The distance between each vertex and the attachment point in the target attachment model is calculated to obtain the first distance corresponding to each vertex; Calculate the ratio between the first distance and the longest distance corresponding to each vertex to obtain the scaling weight of each vertex in the target attachment model.
12. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the adaptation method of the accessory model according to any one of claims 1-10.
13. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the adaptation method of the accessory model as described in any one of claims 1-10.
Citation Information
Patent Citations
Target display method and device
CN113797529A
