Game role skin modeling method and system

By using iterative edge detection and multi-style layer Gram matrix analysis in the game character skin modeling, the number of style transfers is dynamically adjusted, which solves the problem of blurred or over-display of contour features caused by fixed style transfers, and improves the diversity and visual effects of game character skins.

CN120259555AActive Publication Date: 2025-07-04北京让时间多点意思网络科技有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510688319.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-07-04
Estimated Expiration
2045-05-26

AI Technical Summary

Technical Problem

In the prior art, game character skin modeling methods with fixed style transfers can easily lead to excessive blurring of the texture or excessive display of character outline features, resulting in low content style adaptation and affecting modeling effect.

Method used

Iterative edge detection is performed by setting the starting grayscale threshold and grayscale step, combining the multi-style layer Gram matrix in the VGG19 neural network, the outline ambiguity and content texture expression during the style transfer process are analyzed, and the number of style transfers is dynamically adjusted to obtain the best style transfer effect.

Benefits of technology

It achieves the clarity of the original feature outline of the clothing map and the content texture expressiveness while ensuring the modeling effect of the game character skin, improving the diversity and visual performance of the game character skin.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259555A_ABST
    Figure CN120259555A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of costume chartlet processing, in particular to a game role skin modeling method and system. Firstly, a plurality of style images and costume chartlets of game roles are obtained. Performing iterative edge detection on the costume chartlet, analyzing contour distribution and calculating a content texture representation degree so as to quantify an original detail retention degree; a neural network is adopted to fuse the Gram matrix of the multi-style image, and composite style representation is constructed; in the iterative migration process, combining the matrix feature prominence, the number of iterations, the content texture representation degree, the dynamic tracking stylization degree and the balance point reserved by the original features, and calculating the style content adaptation degree; finally, the optimal migration frequency is accurately positioned by analyzing the difference condition of the style content adaptation degrees of all the costume chartlets, detail loss caused by excessive stylization is effectively avoided, diversified style fusion is achieved on the premise that the expressive force of the costume chartlets is guaranteed, and the game modeling effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of clothing texture processing, and specifically relates to a method and system for modeling the skin of game characters. Background Art

[0002] In the field of game development, character skin modeling is a key link to enhance the visual appeal and player immersion of games. With the rapid development of the game industry and the improvement of players' aesthetic levels, the demand for stylization and diversification of game character skins is increasing day by day. The process of skin character modeling generally includes: original painting design, 3D modeling, UV unwrapping, texture painting, bone binding and animation, and engine adaptation. When formulating new game character skins, new texture UV maps are usually drawn according to existing style series (such as the Spring Festival series, the pool series, the ink-wash style series, etc.).

[0003] The prior art usually inputs a style image and a UV map into the VGG19 neural network for style transfer (fusing the content of one image with the style of another image to generate an image with a new style), and specifies a fixed number of style transfer times to obtain the final map and perform subsequent processings; however, the map obtained with a fixed number of style transfer times may be overly blurred or overly display the original contour model features of the game character (such as head shape, body shape, etc.), resulting in a low content style adaptation degree and an unsatisfactory effect of game character skin modeling. Summary of the Invention

[0004] In order to solve the technical problem that the map obtained with a fixed number of style transfer times may be overly blurred or overly display the original contour model features of the game character (such as head shape, body shape, etc.), resulting in a low content style adaptation degree and an unsatisfactory effect of game character skin modeling, the purpose of the present invention is to provide a method and system for modeling the skin of game characters, and the specific technical solutions adopted are as follows: A method for modeling the skin of game characters, comprising: Obtaining the clothing texture map in the initial skin image of each game character, and obtaining multiple style images; Setting a starting gray-scale threshold and a gray-scale step size, performing iterative edge detection on each clothing texture map, and determining an optimal gray-scale threshold and an optimal number of iterations based on the distribution of edge lines in the clothing texture map during each iteration for calculating the content texture expressiveness of each clothing texture map; After preselecting multiple style layers in the VGG19 neural network and setting weights to process each style image, at the same depth, fusing the Gram matrices of all style images under all style layers to obtain a composite matrix; Iteratively perform style transfer on each clothing texture map using a composite matrix and the VGG19 neural network. In each style transfer, analyze the prominence of the element values in the Gram matrix of the style layer and the number of iterations, and combine them with the content texture expressiveness to obtain the style-content adaptability. Compare the differences in the style-content adaptability of all clothing texture maps to determine the optimal number of style transfer iterations, so as to obtain new-style clothing texture maps for game character skin modeling.

[0005] Furthermore, set the starting grayscale threshold and grayscale step size, and perform iterative edge detection on each clothing texture map. Based on the distribution of the edge lines in the clothing texture map during each iteration, determine the optimal grayscale threshold and the optimal number of iterations, including: During each iteration, determine the updated grayscale threshold for each iteration based on the starting grayscale threshold, the number of iterations, and the grayscale step size; Perform edge detection on each clothing texture map based on the Sobel edge detection algorithm and the updated grayscale threshold to obtain all the edge lines; Take the number of pixel points of the closed edge lines as the first quantity factor, take the number of pixel points of the remaining edge lines as the second quantity factor, and take the normalized value of the ratio of the second quantity factor to the first quantity factor as the contour blur degree during each iteration. Among them, if the first quantity factor does not exist, the contour blur degree is a preset value; When the updated threshold is non-positive, stop the iterative edge detection process. Among all the iteration times, take the iteration time with the minimum contour blur degree as the optimal number of iterations, and take the updated grayscale threshold corresponding to the minimum contour blur degree as the optimal grayscale threshold.

[0006] Furthermore, the method for obtaining the updated grayscale threshold includes: During each iteration, multiply the number of iterations by the grayscale step size as the adjusted grayscale value; Take the difference between the starting grayscale threshold and the adjusted grayscale value as the updated grayscale threshold for each iteration.

[0007] Furthermore, the method for obtaining the content texture expressiveness includes: Take the ratio of the optimal grayscale threshold corresponding to each clothing texture map to the starting grayscale threshold as the first expressiveness factor; Take the value obtained by performing a negative correlation mapping on the ratio of the optimal number of iterations corresponding to each clothing texture map to the total number of iterations as the second expressiveness factor; Take the normalized value of the product of the first expressiveness factor and the second expressiveness factor as the content texture expressiveness of each clothing texture map.

[0008] Furthermore, the method for obtaining the composite matrix includes: At each depth, multiply the weight corresponding to each style layer by each element value in the Gram matrix under each style layer to obtain weighted element values; Take the mean of the weighted element values at the same position in the Gram matrices of all style layers at each depth as the element value at the same position in the composite matrix, thereby obtaining the composite matrix at each depth.

[0009] Further, the method for obtaining the style-content fitness includes: Under each style transfer, analyze the prominence of the element values in the Gram matrices of each style layer at the same depth compared to other style layers, and combine with the number of iterations to determine the style influence effectiveness value for each depth; Take the value obtained by performing a negative correlation mapping on the ratio of the content texture expressiveness of each clothing texture map to the style influence effectiveness value for each depth as the style-content adaptation factor; Under each style transfer, take the value obtained by normalizing the mean of the style-content adaptation factors of each clothing texture map at all depths as the style-content fitness of each clothing texture map under each style transfer.

[0010] Further, the method for obtaining the style influence effectiveness value includes: At the same depth, arbitrarily select one style layer as the target layer. At the same position in the Gram matrix, take the weighted element value of the target layer as the numerator, and take the mean of the weighted element values corresponding to the two style layers closest to the target layer as the denominator, and take the obtained ratio as the eigenvalue of the target layer at this position; Take the mean of the eigenvalues of the target layer at all positions in the Gram matrix as the style influence effectiveness factor of the target layer; At the same depth, take the value obtained by normalizing the product of the mean of the style influence effectiveness factors of all style layers and the number of style transfers as the style influence effectiveness value for this depth.

[0011] Further, the method for obtaining the optimal number of style transfers includes: During the iterative style transfer process, under each style transfer, in the style-content fitness of all clothing texture maps, take the difference between the maximum value and the minimum value as the distribution range; Among all clothing texture maps, calculate the absolute value of the difference between the style-content fitness of any two clothing texture maps as the difference factor; Take the value obtained by performing a negative correlation mapping and normalizing the product of the sum of all difference factors and the distribution range as the style-content coordination factor under each style transfer; During the iterative style transfer process, when the style content coordination factor under a certain style transfer is greater than the preset coordination threshold, stop the iteration and use the current style transfer count as the optimal style transfer count.

[0012] Further, the obtaining of the new-style clothing texture map for game character skin modeling includes: According to the optimal style transfer count, use the VGG19 neural network to perform style transfer on each clothing texture map to obtain the corresponding new-style clothing texture map; Bind the 3D model of the game character to the skeleton to generate an animation in which the model deforms naturally during joint movement; Import all the new-style clothing texture maps, the remaining texture maps in the initial skin image of the game character, the 3D model of the game character, and the animation into the game engine, so as to generate a new skin model of the game character and perform game character skin modeling.

[0013] A game character skin modeling system includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory. When at least one instruction, at least one program, the code set, or the instruction set is loaded and executed by the processor, the steps of a game character skin modeling method are implemented.

[0014] The present invention has the following beneficial effects: The modeling of game character skins usually involves processing the clothing of game characters. Therefore, first, the clothing texture maps in the initial skin images of each game character are obtained, and multiple style images are also obtained. The style images are used for style transfer of the clothing texture maps. During the process of style transfer, features such as excessive blurring or over - display may occur, resulting in an unsatisfactory modeling effect. The original feature contours of the clothing texture maps are important factors affecting the performance effect. Therefore, a starting gray - scale threshold and a step size are set, and iterative edge detection is performed on each clothing texture map, and the distribution of the edge lines (contour features) is analyzed to calculate the content texture expressiveness of each clothing texture map, which is used to reflect the ease with which the original internal clothing details in the clothing texture map can be observed. Style transfer refers to fusing the content of one image with the style of another image. However, there are actually multiple images for expressing the same theme style. To meet the diverse needs of game character skins as much as possible, at each depth of the VGG19 neural network, the Gram matrices of all style images at all style layers can be fused to obtain a composite matrix for fusing multiple detailed styles. Then, the composite matrix and the VGG19 neural network can be used to perform iterative style transfer on each clothing texture map. The content texture expressiveness constraint supervises the theme contour in the clothing texture map, ensuring the expressiveness of the skin content. However, as the number of style transfer times progresses, the content texture features in the generated texture maps will continuously weaken, and the style factors will continuously increase. The overall visual effect will show a trend of first increasing and then decreasing. To find the optimal number of style transfer times, in this invention, at each style transfer, the prominence of the element values in the Gram matrix is analyzed, and combined with the number of iterations and the content texture expressiveness, the style - content fitness is calculated. And the differences between the style - content fitness of all clothing texture maps are compared to determine the optimal number of style transfer times for obtaining new - style clothing texture maps for game character skin modeling. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following - described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0016] Figure 1 It is a flowchart of a method for game character skin modeling provided by an embodiment of the present invention; Figure 2 It is a schematic diagram of a clothing texture map provided by an embodiment of the present invention; Figure 3 It is a flowchart of a method for obtaining the optimal gray - scale threshold and the optimal number of iterations provided by an embodiment of the present invention; Figure 4 Schematic diagram of the distribution of edge lines in each iteration under iterative edge detection provided by an embodiment of the present invention; Figure 5 Schematic diagram of the relationship between visual effects and the number of style migrations provided by an embodiment of the present invention; Figure 6 Flowchart of a method for obtaining style content adaptability provided by an embodiment of the present invention; Figure 7 System block diagram of a game character skin modeling system provided by an embodiment of the present invention; Figure 8 Schematic diagram of the system structure of a game character skin modeling system provided by an embodiment of the present invention. Detailed implementation manners

[0017] In order to further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation manners, structures, features and effects of a game character skin modeling method and system proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs.

[0019] The following specifically describes the specific solutions of a game character skin modeling method and system provided by the present invention with reference to the accompanying drawings.

[0020] Please refer to Figure 1 , which shows a flowchart of a game character skin modeling method provided by an embodiment of the present invention. The method includes the following steps: Step S1: Obtain the clothing texture maps in the initial skin images of each game character and obtain multiple style images.

[0021] Game character skins mainly refer to a form of visual customization used to change the appearance of game characters, which is mainly achieved by creating specific texture UV maps. To enable the normal use of game character skins in games, modeling processing of game character skins is required. The general process is as follows: Original painting design: Draw the character setting diagram; 3D modeling: Perform 3D modeling based on the character setting diagram (including the front, side, and back) to obtain a 3D model; UV unwrapping: Unwrap the 3D model into a 2D planar UV map; Texture painting: Paint and render the 2D planar map to obtain a specific texture UV map; Bone binding and animation: Bind the 3D model to the bones to generate an animation where the model deforms naturally during joint movement; Engine adaptation: After importing the 3D model, specific texture UV map, and animation into the game engine, complete the entire process of game character modeling.

[0022] When developing new game character skins, new texture UV maps are usually drawn according to existing style series (such as the Spring Festival series, pool series, ink painting style series, etc.). Specifically, the style image and the UV map can be input into the VGG19 neural network model for style transfer (fusing the content of one image with the style of another image to generate an image with a new style). The general process of using the VGG19 neural network model for style transfer is as follows: (1) Input the content image and the style image to generate a copy of the image containing random white noise as the starting point for optimization; (2) Perform hierarchical processing on the content image and the style image through the VGG19 neural network model respectively: In the hierarchical processing of the content image, select a deeper layer (such as conv4_2) as the content layer; In the hierarchical processing of the style image, select multiple shallow and deep layers (such as conv1_1, conv2_1, conv3_1, conv4_1, conv5_1) as the style layers. (The VGG19 network model consists of 5 blocks, a total of 19 layers, including 16 convolutional layers and the last 3 fully connected layers. Since no corresponding prediction or classification is required in style transfer, the last fully connected layer is not used. Therefore, the convolutional operations of the 5 blocks in VGG19 from shallow to deep are mainly used to obtain feature maps (the width and height gradually decrease, and the depth increases layer by layer); (3) Set the loss function (content loss, style loss); (4) After setting the above parameters, start iterating from the optimization starting point, and obtain the image after style transfer after the iteration is completed.

[0023] It should be noted that the VGG19 neural network model is a well-known technology, and the specific process and operations will not be elaborated here.

[0024] Under normal circumstances, the process of creating new skin models for game characters is carried out based on existing game characters. Therefore, in the embodiments of the present invention, the UV texture maps of game characters can be exported from the game directory, and the compressed packages of the UV texture maps can be decompressed into the local storage space to obtain multiple initial skin images of each game character. In the initial skin images of game characters, the texture maps of the human body surface types such as the human face and hands of the game characters usually do not change significantly. The skin modeling of game characters usually performs drawing processing on the texture maps of object types such as the clothing and weapons of the game characters. Therefore, each initial skin image of the game character can be manually screened to select the texture maps of object types, and thus the clothing texture maps in the initial skin images of each game character are obtained. Please refer to Figure 2 , which shows a schematic diagram of a clothing texture map.

[0025] At the same time, multiple style images of the same style series can be selected from the local style series database. In this embodiment of the present invention, the number of style images is set to 3, and the specific number can be adjusted according to the implementation scenario and is not limited here.

[0026] Step S2: Set the starting gray threshold and the gray step size, perform iterative edge detection on each clothing texture map, and determine the optimal gray threshold and the optimal number of iterations based on the distribution of the edge lines in the clothing texture map during each iteration for calculating the content texture expressiveness of each clothing texture map.

[0027] In the subsequent style transfer process, as the number of iterations of the style transfer increases, the obtained texture maps may become overly blurred or overly display the contour features of the character, resulting in an unsatisfactory final game character skin modeling effect. Among these two unsatisfactory effects, the original feature contours in the texture maps are the main influencing factors for the obvious performance effect. Therefore, the effect of the subsequent style transfer process can be adjusted by analyzing the contour features in the clothing texture maps.

[0028] For the skin of game characters, each clothing texture map is composed of a combination of multiple layers of textures. Affected by color factors such as color and contrast, the highlighting effects of these multiple layers of textures are different. In the style transfer process, the outer layer of textures mainly guarantees the main contour of the clothing, and these main contours guarantee the most basic content range. If these main contours are damaged, the content range after the style layer change will not be greatly restricted, resulting in the loss of the effective expression of the skin content. And the contour can be mainly characterized by edge lines. Therefore, in this embodiment of the present invention, the starting gray threshold and the gray step size are set, iterative edge detection is performed on each clothing texture map, and the optimal gray threshold and the optimal number of iterations are determined based on the distribution of the edge lines in the clothing texture map during each iteration for calculating the content texture expressiveness of each clothing texture map.

[0029] Preferably, in an embodiment of the present invention, the method for obtaining the optimal gray threshold and the optimal number of iterations includes: Please refer to Figure 3 , which shows a flowchart of the method for obtaining the optimal gray threshold and the optimal number of iterations in an embodiment of the present invention. The method includes the following steps: Step S201: At each iteration, determine the updated gray threshold at each iteration based on the starting gray threshold, the number of iterations, and the gray step size.

[0030] In this embodiment of the present invention, the starting gray threshold is set to 255. During the iteration process, the external contour in the clothing texture map, that is, the main contour, appears first. As the gray threshold continuously decreases, the detected main contour will continuously connect and thicken the edges on the basis of the previous ones. Therefore, at each iteration, multiply the number of iterations by the gray step size as the adjustment gray value, and then use the difference between the starting gray threshold and the adjustment gray value as the updated gray threshold at each iteration.

[0031] It should be noted that in this embodiment of the present invention, the gray step size is set to 30, and the specific setting of the step size can be adjusted according to the implementation scenario and will not be limited here.

[0032] Step S202: Based on the updated gray threshold, perform edge detection on each clothing texture map using an edge detection algorithm to obtain all the edge lines.

[0033] Extract structured edges under the constraint of the updated gray threshold: At each iteration, perform edge detection on each clothing texture map based on the Sobel edge detection algorithm and the updated gray threshold to obtain all the edge lines.

[0034] It should be noted that the Sobel edge detection algorithm is a well-known technology, and the specific process will not be elaborated here.

[0035] Step S203: Analyze the distribution of the edge lines in each clothing texture map to determine the contour blurriness at each iteration.

[0036] Based on the analysis in step S201, as the number of iterations increases, the main contour will be connected and thickened, which means that the proportion of pixel points representing the main contour will gradually increase. Then, the proportion of the closed edge line will increase. Therefore, in each iteration, the number of pixel points of the closed edge line is used as the first quantity factor, and the number of pixel points of the remaining edge lines is used as the second quantity factor. The smaller the first quantity factor, the fewer the number of pixel points representing the main contour, and the greater the contour blur. Therefore, the value obtained by normalizing the ratio of the second quantity factor to the first quantity factor is used as the contour blur in each iteration. Among them, when the first quantity factor does not exist, the contour blur is a preset value. Normalization is a well-known technical means to those skilled in the art. The choice of the normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here.

[0037] In this embodiment of the present invention, when the first quantity factor does not exist, it is considered that the contour blur is the largest. Given that the value range of the contour blur when the first quantity factor exists is 0 to 1, the preset value is set to 1 here.

[0038] Step S204: Among all the iteration times, compare the contour blur to determine the optimal gray threshold and the optimal iteration times.

[0039] During the iterative edge detection process, when the updated threshold is a non-positive number, the iterative edge detection process stops.

[0040] The optimal iteration times should be the iteration times when the main contour is the clearest. Therefore, among all the iteration times, the iteration times with the minimum contour blur are used as the optimal iteration times, and the updated gray threshold corresponding to the minimum contour blur is used as the optimal gray threshold.

[0041] Please refer to Figure 4 , which shows the schematic diagram of the distribution of the edge lines in each iteration under the iterative edge detection in this embodiment of the present invention.

[0042] It should be noted that in this embodiment of the present invention, when processing an image, if grayscale conversion of the image is required, methods such as average grayscale conversion, maximum value method, or weighted grayscale conversion can be used, and they are all well-known technical means to those skilled in the art, which are not limited and elaborated here.

[0043] So far, during the iterative edge detection of each clothing texture map, the optimal gray threshold and the optimal iteration times can be determined. These two indicators represent the gray threshold and the iteration times when the main contour of the clothing texture map is the clearest, and the content texture expressiveness of each clothing texture map can be calculated based on these two indicators.

[0044] Preferably, in an embodiment of the present invention, the method for obtaining the content texture expressiveness includes: During the iterative edge detection process, the earlier the best edge display times appear, that is, the smaller the best iteration times, it indicates that the original color contrast of the clothing texture map is more obvious, and it reflects that the content expressiveness of the clothing texture in the clothing texture map is stronger.

[0045] In view of the fact that the gray-scale threshold gradually decreases as the iterative edge detection progresses, the larger the optimal gray-scale threshold, the stronger the content texture expressiveness. Therefore, the ratio of the optimal gray-scale threshold corresponding to each clothing texture map to the starting gray-scale threshold is used as the first expressiveness factor. The larger the first expressiveness factor, the earlier the best iteration times appear, and the better the texture expressiveness of the clothing texture map.

[0046] In view of the fact that the smaller the best iteration times, the better the content texture expressiveness, the ratio of the best iteration times corresponding to each clothing texture map to the total iteration times is subjected to a negative correlation mapping process to correct the logical relationship, so as to obtain the second expressiveness factor. At this time, the larger the second expressiveness factor, the earlier the best iteration times appear, and the better the content texture expressiveness of the clothing texture map. The negative correlation mapping and normalization process here can adopt the formula , where represents the exponential function with the natural constant e as the base, and x represents the independent variable.

[0047] Finally, the value obtained by normalizing the product of the first expressiveness factor and the second expressiveness factor is used as the content texture expressiveness of each clothing texture map. The normalization is a well-known technical means in the art. The choice of the normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here.

[0048] Step S3: After preselecting multiple style layers in the VGG19 neural network and setting weights to process each style image, at the same depth, fuse the Gram matrices of all style images under all style layers to obtain a composite matrix.

[0049] Style transfer refers to the process of integrating the content of one image with the style of another image to generate an image with a new style. Conventionally, when using the VGG19 neural network for style transfer of a target image, only the style of one image is artificially selected as the style that the neural network needs to transfer, and the Gram matrix is extracted from this image as the style matrix for the subsequent style transfer process. However, style expression is a relatively vague concept. The expression of the same theme style (e.g., Spring Festival) may actually have multiple styles of images, and these images will display the same theme style in their respective relatively unique ways. And due to the fact that in the actual scenario, the requirements for the skins of game characters vary due to individual and quantitative differences among players, thus, when actually designing the skins of game characters, it is usually composite (e.g., under the Spring Festival series, the hybrid style of the Spring Festival style in different detailed style ways) to try to meet the diverse needs of game character skins. Therefore, in this embodiment of the present invention, after preselecting multiple style layers in the VGG19 neural network and setting weights to process each style image, at the same depth, the Gram matrices of all style images at all style layers are fused to obtain a composite matrix. The composite matrix can synthesize the Gram matrices of these style images at all style layers at the same depth as a matrix representing the integration of multiple detailed style ways.

[0050] Preferably, in an embodiment of the present invention, the method for obtaining the composite matrix includes: First, each style image is stratified based on the VGG19 neural network. In this embodiment of the present invention, conv1_1, conv2_1, conv3_1, conv4_1, conv5_1 are used as style layers (the selected layers can be changed according to requirements), and the Gram matrix of each style image at each style layer is obtained, where the weight of each style layer can be set by itself according to the implementation scenario, and the range is between 0 and 1.

[0051] The sizes of the Gram matrices at the same depth are the same, and the number of elements they contain is also the same. Therefore, all the Gram matrices at each depth are fused: at each depth, the weight corresponding to each style layer is multiplied by each element value in the Gram matrix of each style layer to obtain a weighted element value. At this time, the element values in all the Gram matrices at each depth are weighted element values.

[0052] Finally, at the same depth, the mean value of the weighted element values at the same position in the Gram matrices of all style layers is used as the element value at the same position in the composite matrix, thereby obtaining the composite matrix at each depth.

[0053] Step S4: Use the composite matrix and the VGG19 neural network to perform iterative style transfer on each clothing texture map. In each style transfer, analyze the prominence of the element values in the Gram matrix of the style layer and the number of iterations, and combine them with the content texture expressiveness to obtain the style-content adaptability. Compare the differences between the style-content adaptabilities of all clothing texture maps to determine the optimal number of style transfer iterations, so as to obtain a new-style clothing texture map for game character skin modeling.

[0054] According to the composite matrix at each depth, use the VGG19 neural network to perform iterative style transfer on each local clothing map. Set the initial value of the number of style transfer iterations to 1 and the step size to 1, so as to obtain a new-style clothing texture map after style transfer for game character skin modeling.

[0055] The content texture expressiveness of each clothing texture map constrains and supervises the main outline of the skin content in the clothing texture map, ensuring the expressiveness of the skin content. However, in the process of iterative style transfer, as the number of style transfer iterations progresses, the content texture features in the newly generated clothing texture map with the new style will gradually weaken, and its style factors will gradually increase. The two are in an overall reverse distribution state, and the corresponding visual effect will change in a trend of first increasing and then decreasing. Please refer to Figure 5 , which shows a schematic diagram of the relationship between the visual effect and the number of style transfer iterations in an embodiment of the present invention. Since the style factors come from the composite matrix, the composite matrix will directly affect the visual effect of the generated local clothing texture map with the new style. Among them, if the style weights contained in the composite matrix are more complex, it means that the style factors are more hybrid and comprehensive. Therefore, with the iteration of the number of style transfer iterations under the composite matrix, various detailed style methods hybridized in the style factors will be gradually amplified, thus further amplifying the trend of the continuous increase of the style factors. Therefore, in order to determine the optimal number of style transfer iterations, in each style transfer, the prominence of the element values in the Gram matrix of the style layer and the number of iterations are analyzed, and they are combined with the content texture expressiveness to obtain the style-content adaptability. Finally, compare the differences between the style-content adaptabilities of all clothing texture maps to determine the optimal number of style transfer iterations, so as to obtain a new-style clothing texture map for game character skin modeling.

[0056] Preferably, in an embodiment of the present invention, the method for obtaining the style-content adaptability includes: Please refer to Figure 6 , which shows a flowchart of the method for obtaining the style-content adaptability in an embodiment of the present invention. The method includes the following steps: Step S401: Under each style transfer, analyze the prominence of the element values in the Gram matrix of each style layer at the same depth compared to those in the Gram matrices of other style layers, and combine with the number of iterations to determine the style influence effectiveness value for each depth.

[0057] At the same depth, arbitrarily select a style layer as the target layer. At the same position in the Gram matrix, use the weighted element value of the target layer as the numerator, and use the average of the weighted element values corresponding to the two style layers closest to the target layer as the denominator. Take the resulting ratio as the eigenvalue of the target layer at this position. The larger the eigenvalue, the greater the prominence of the weighted element value of the target layer. Then, take the average of the eigenvalues of the target layer at all positions in the Gram matrix as the style influence effectiveness factor of the target layer. At this time, the larger the style influence effectiveness factor, the greater the proportion of the influence of the Gram matrix of the target layer.

[0058] As the number of iterations progresses, the proportion of style influence will become heavier, while the content texture features will continuously weaken. Therefore, finally, at the same depth, the value obtained by normalizing the product of the average of the style influence effectiveness factors of all style layers and the number of style transfers is used as the style influence effectiveness value for this depth. The larger this value, the greater the style influence. Among them, normalization is a well-known technical means to those skilled in the art. The choice of the normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here.

[0059] Step S402: Combine the content texture performance of each clothing texture map and the style influence effectiveness value at each depth to determine the style-content adaptation factor.

[0060] For each clothing texture map, the texture distribution at the optimal number of iterations during its iterative edge detection process is the clothing texture combination that best represents the skin of its game character; and the corresponding content texture performance reflects to a certain extent the contrast when creating a new-style skin based on the texture of the original content. The larger the content texture performance, the greater the restriction of the content texture on the new-style skin modeling during style transfer, and the easier it is to observe the skin change effect after style transfer. Therefore, based on the content texture performance of each clothing texture map and the style influence effectiveness value at each depth under each style transfer, the content-style adaptation degree under the current style transfer can be calculated.

[0061] Calculate the ratio of the content texture expressiveness of each clothing texture map to the style influence effectiveness value at each depth. The larger the ratio, the greater the restriction of the content texture and the smaller the influence of the style. Therefore, the value after negatively correlating and mapping this ratio is used as the style-content adaptation factor. At this time, the larger the style-content adaptation factor, the smaller the restriction of the content texture and the greater the influence of the style factor. The negative correlation mapping here can adopt , where x represents the independent variable.

[0062] Step S403: Under each style transfer, fuse the style-content adaptation factors of each clothing texture map at all depths to obtain the style-content adaptation degree of each clothing texture map under each style transfer.

[0063] Based on the foregoing steps, the style-content adaptation factors of each clothing texture map at each depth under each style transfer can be obtained. Here, the style-content adaptation factors at all depths can be fused: Under each style transfer, the value obtained by normalizing the mean of the style-content adaptation factors of each clothing texture map at all depths is used as the style-content adaptation degree of each clothing texture map under each style transfer. Among them, normalization is a well-known technical means to those skilled in the art. The choice of the normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here.

[0064] After obtaining the style-content adaptation degree of each clothing texture map under each style transfer, in the actual process, since there are certain clothing features among different clothing texture maps, after style processing, the clothing feature differences between different clothing texture maps may increase, resulting in an inconsistent visual effect after the clothing texture maps are combined for skin modeling. Therefore, under the same number of iterations of style transfer, it is necessary to supervise the style coordination of different clothing texture maps, that is, under each style transfer, compare the differences between the style-content adaptation degrees of all clothing texture maps to determine the optimal number of style transfers.

[0065] Preferably, in an embodiment of the present invention, the method for obtaining the optimal number of style transfers includes: During the iterative style transfer process, under each style transfer, among the style-content adaptation degrees of all clothing texture maps, take the difference between the maximum value and the minimum value as the distribution range. The larger the distribution range, the greater the difference between the style-content adaptation degrees of all clothing texture maps under this style transfer, and thus the worse the coordination. Therefore, the possibility of this style transfer being the optimal number of style transfers will be lower.

[0066] Then, among all the clothing texture maps, calculate the absolute value of the difference between the style-content fitness degrees of any two clothing texture maps as the difference factor. The larger the difference factor, the worse the coordination of the style and content of these two clothing texture maps, and it can also reflect that the possibility of this style transfer being the optimal style transfer times is lower.

[0067] Next, multiply the sum value of all the difference factors by the distribution range. Based on the foregoing analysis, the larger the product of the two, the worse the coordination among all the clothing texture maps under a certain style transfer. Therefore, perform a negative correlation mapping and normalization process on this product to correct the logical relationship, so as to obtain the style-content coordination factor under each style transfer. The larger the style-content coordination factor at this time, the better the style coordination of all the clothing texture maps under this style transfer. The negative correlation mapping and normalization here can adopt the formula , where represents the exponential function with the natural constant e as the base, and x represents the independent variable.

[0068] Therefore, finally, in the iterative style transfer process, when the style-content coordination factor under a certain style transfer is greater than the preset coordination threshold, stop the iteration and use the current style transfer times as the optimal style transfer times.

[0069] It should be noted that in this embodiment of the present invention, the preset coordination threshold is set to 0.8, and the specific value can be adjusted according to the implementation scenario and is not limited here.

[0070] So far, the optimal style transfer times can be obtained, and the clothing texture maps can be further processed based on the optimal style transfer times, so as to obtain new-style clothing texture maps for game character skin modeling.

[0071] Preferably, in an embodiment of the present invention, obtaining new-style clothing texture maps for game character skin modeling includes: According to the optimal style transfer times, use the VGG19 neural network to perform style transfer on each clothing texture map to obtain the corresponding new-style clothing texture maps.

[0072] Then bind the 3D model of the game character to the skeleton to generate an animation in which the model deforms naturally during joint movement.

[0073] Finally, import all the new-style clothing texture maps, the remaining texture maps in the initial skin image of the game character, the 3D model of the game character, and the animation into the game engine, so as to generate a new skin model of the game character and perform game character skin modeling.

[0074] It should be noted that the operations such as using the VGG19 neural network for style transfer, 3D modeling, and importing into the game engine mentioned in this embodiment of the present invention are all well-known technologies, and the specific processes are not elaborated here.

[0075] In summary, game character skin modeling usually processes the clothing of game characters. Therefore, first, the clothing texture map in the initial skin image of each game character is obtained, and at the same time, multiple style images are obtained. The style images are used for style transfer of the clothing texture map. During the style transfer process, features of over-blurring or over-display may occur, making the modeling effect unsatisfactory. The original feature contour of the clothing texture map is an important factor affecting the performance effect. Therefore, the starting gray threshold and step size are set, iterative edge detection is performed on each clothing texture map, and the distribution of the edge lines (contour features) is analyzed, so as to calculate the content texture expressiveness of each clothing texture map, which is used to reflect the simplicity degree of the original internal clothing details in the clothing texture map that can be observed. Style transfer refers to the fusion of the content of one image with the style of another image. However, there are actually multiple images for the expression of the same theme style. In order to meet the diverse needs of game character skins as much as possible, at each depth of the VGG19 neural network, the Gram matrices of all style images at all style layers can be fused to obtain a composite matrix, which is used to fuse multiple detailed styles. Then, the composite matrix and the VGG19 neural network can be used to perform iterative style transfer on each clothing texture map. The content texture expressiveness constraint supervises the theme contour in the clothing texture map and ensures the expressiveness of the skin content. However, as the number of style transfer times progresses, the content texture features in the generated texture map will continuously weaken, and the style factors will continuously increase. The overall visual effect will show a trend of first increasing and then decreasing. In order to find the optimal number of style transfer times, in the embodiments of the present invention, at each style transfer, the prominence of the element values in the Gram matrix is analyzed, and combined with the number of iteration times and the content texture expressiveness, the style-content fitness is calculated. And the differences between the style-content fitnesses of all clothing texture maps are compared, so as to determine the optimal number of style transfer times for obtaining new-style clothing texture maps for game character skin modeling.

[0076] The embodiments of the present invention also provide a game character skin modeling system. Please refer to Figure 7 , which shows a system block diagram, including: a data acquisition module 701, used to implement step S1 in the above method embodiment; a content texture analysis module 702, used to implement step S2 in the above method embodiment; a composite matrix fusion module 703, used to implement step S3 in the above method embodiment; a style transfer and modeling module 704, used to implement step S4 in the above method embodiment.

[0077] It should be noted that the system provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, an embodiment of a game character skin modeling system and an embodiment of a game character skin modeling method provided in the above embodiments belong to the same concept. For the specific implementation process, please refer to the method embodiment and will not be elaborated here.

[0078] Please refer to Figure 8 , which shows a schematic diagram of the system structure of a game character skin modeling system provided by an embodiment of the present invention, including a processor 800, a memory 801, a bus 802, and a communication interface 803. The processor 800, the communication interface 803, and the memory 801 are connected through the bus 802. Among them, the memory 801 may include a high-speed random access memory. The bus 802 may be an ISA bus, a PCI bus, an EISA bus, etc. The processor 800 may be an integrated circuit chip with signal processing capabilities. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory 801. When at least one instruction, at least one program, a code set, or an instruction set is loaded and executed by the processor, the steps in a game character skin modeling method are implemented.

[0079] It should be noted that the above sequence of the embodiments of the present invention is only for description and does not represent the superiority or inferiority of the embodiments. The processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0080] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

Claims

1. A method for modeling a game character skin, characterized in that, The method includes: Obtain the clothing texture maps in the initial skin images of each game character, and obtain multiple style images; Set the starting gray-scale threshold and the gray-scale step size, perform iterative edge detection on each clothing texture map, and based on the distribution of the edge lines in the clothing texture map during each iteration, determine the optimal gray-scale threshold and the optimal number of iterations for calculating the content texture expressiveness of each clothing texture map; After preselecting multiple style layers in the VGG19 neural network and setting weights to process each style image, at the same depth, fuse the Gram matrices of all style images under all style layers to obtain a composite matrix; Use the composite matrix and the VGG19 neural network to perform iterative style transfer on each clothing texture map. During each style transfer, analyze the prominence of the element values in the Gram matrix of the style layer and the number of iterations, and combine them with the content texture expressiveness to obtain the style-content fitness; compare the differences between the style-content fitnesses of all clothing texture maps to determine the optimal number of style transfer times, so as to obtain new-style clothing texture maps for game character skin modeling.

2. The method for modeling a game character skin according to claim 1, wherein The setting of the starting gray-scale threshold and the gray-scale step size, performing iterative edge detection on each clothing texture map, and determining the optimal gray-scale threshold and the optimal number of iterations based on the distribution of the edge lines in the clothing texture map during each iteration includes: During each iteration, determine the updated gray-scale threshold for each iteration based on the starting gray-scale threshold, the number of iterations, and the gray-scale step size; Perform edge detection on each clothing texture map based on the Sobel edge detection algorithm and the updated gray-scale threshold to obtain all the edge lines; Take the number of pixel points of the closed edge lines as the first quantity factor, take the number of pixel points of the remaining edge lines as the second quantity factor, and take the value obtained by normalizing the ratio of the second quantity factor to the first quantity factor as the contour blurriness during each iteration. Among them, if the first quantity factor does not exist, the contour blurriness is a preset value; When the updated threshold is non-positive, stop the iterative edge detection process, and among all the iteration times, take the iteration time with the minimum contour blurriness as the optimal number of iterations, and take the updated gray-scale threshold corresponding to the minimum contour blurriness as the optimal gray-scale threshold.

3. The method for modeling a game character skin according to claim 2, wherein The method for obtaining the updated gray-scale threshold includes: During each iteration, multiply the number of iterations by the gray-scale step size as the adjusted gray-scale value; Take the difference between the starting gray-scale threshold and the adjusted gray-scale value as the updated gray-scale threshold for each iteration.

4. A method for modeling a game character skin according to claim 1, characterized in that, The method for obtaining the content texture expressiveness includes: Take the ratio of the optimal gray-scale threshold corresponding to each clothing texture map to the starting gray-scale threshold as the first expressiveness factor; Take the value obtained by performing a negative correlation mapping on the ratio of the optimal number of iterations corresponding to each clothing texture map to the total number of iterations as the second expressiveness factor; Take the value obtained by normalizing the product of the first expressiveness factor and the second expressiveness factor as the content texture expressiveness of each clothing texture map.

5. A method for modeling a game character skin according to claim 1, characterized in that, The method for obtaining the composite matrix includes: At each depth, multiply the weight corresponding to each style layer by each element value in the Gram matrix under each style layer to obtain the weighted element value; Take the mean of the weighted element values at the same position in the Gram matrices of all style layers at each depth as the element value at the same position in the composite matrix, thereby obtaining the composite matrix at each depth.

6. A method for modeling a game character skin according to claim 5, characterized in that, The method for obtaining the style-content adaptation degree includes: Under each style transfer, analyze the prominence of the element values in the Gram matrix of each style layer at the same depth compared to other style layers, and combine the number of iterations to determine the style influence effectiveness value for each depth; Take the value obtained by performing a negative correlation mapping on the ratio of the content texture expressiveness of each clothing texture map to the style influence effectiveness value for each depth as the style-content adaptation factor; Under each style transfer, take the value obtained by normalizing the mean of the style-content adaptation factors of each clothing texture map at all depths as the style-content adaptation degree of each clothing texture map under each style transfer.

7. A method for modeling a game character skin according to claim 6, wherein, The method for obtaining the style influence effectiveness value includes: At the same depth, arbitrarily select a style layer as the target layer. At the same position in the Gram matrix, take the weighted element value of the target layer as the numerator, and take the mean of the weighted element values corresponding to the two style layers closest to the target layer as the denominator, and take the resulting ratio as the eigenvalue of the target layer at this position; Take the mean of the eigenvalues of the target layer at all positions in the Gram matrix as the style influence effectiveness factor of the target layer; At the same depth, take the value obtained by normalizing the product of the mean of the style influence effectiveness factors of all style layers and the number of style transfers as the style influence effectiveness value for this depth.

8. A method for modeling a game character skin according to claim 1, characterized in that The method for obtaining the optimal number of style transfers includes: During the iterative style transfer process, under each style transfer, in the style-content adaptation degrees of all clothing texture maps, take the difference between the maximum value and the minimum value as the distribution range; Among all clothing texture maps, calculate the absolute value of the difference between the style-content adaptation degrees of any two clothing texture maps as the difference factor; Take the value obtained by performing a negative correlation mapping and normalizing the product of the sum of all difference factors and the distribution range as the style-content coordination factor under each style transfer; During the iterative style transfer process, when the style-content coordination factor under a certain style transfer is greater than the preset coordination threshold, stop the iteration, and take the current number of style transfers as the optimal number of style transfers.

9. A method for modeling a game character skin according to claim 1, wherein The obtaining of the new-style clothing texture map for use in game character skin modeling includes: According to the optimal number of style transfers, use the VGG19 neural network to perform style transfer on each clothing texture map to obtain the corresponding new-style clothing texture map; Bind the 3D model of the game character to the skeleton to generate an animation in which the model deforms naturally during joint movement; Import all the new-style clothing texture maps, the remaining texture maps in the initial skin image of the game character, the 3D model of the game character, and the animation into the game engine, thereby generating a new skin model for the game character and performing game character skin modeling.

10. A game character skin modeling system, characterized in that, It includes a processor and a memory. At least one instruction, at least one program, a code set or an instruction set is stored in the memory. When the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor, the steps of a method for modeling a game character skin as described in any one of claims 1-9 are implemented.

Citation Information

Patent Citations

  • Particle swarm algorithm-based image edge detection method and system

    CN108053413A

  • Chuxiong textile clothing element migration method and system based on convolutional neural network

    CN116342578A

  • Game role skin modeling method and device, equipment and storage medium

    CN116402676A

  • Game server data storage method and system

    CN118035130A

  • Vision-based building decorative plate pressing quality detection method

    CN118351068A