A method and device for adjusting virtual character skin
By adjusting the RGB color values in the skin map of the virtual character and using skin parameters to display different skin tones, the problem of too large game resource packages is solved and the restrictions on game development are reduced.
Patent Information
- Application Number
- CN202010688814.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-16
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-07-16
AI Technical Summary
When generating different virtual character skins in the prior art, the game resource package is too large, resulting in restrictions on game development.
By obtaining the skin parameters corresponding to the virtual character, including light and shade parameters, glossiness parameters, color power parameters and contrast parameters, the RGB color value of each pixel in the skin map of the virtual character is adjusted to achieve the display of different skin colors and avoid the need for resource packages Too big a problem.
It achieves flexible control of the skin color of virtual characters, reduces the size of the game resource package, and reduces the restrictions on game development.
Smart Images

Figure CN111784814B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a method and device for adjusting the skin of a virtual character. Background Art
[0002] In the current game development process, it is often necessary to display multiple virtual characters in the game scene, and the skins of the virtual characters in the scene may not be exactly the same. Therefore, in the development process, it is necessary to generate virtual characters with different skins according to the needs. The current way to generate virtual characters with different skins in games is usually to change the skin map of the virtual character, such as replacing the diffuse map and normal map of the virtual character skin.
[0003] However, replacing the skin map of the virtual character will make the game resource package very large. For example, assuming that a game character model of a virtual character has 20 different skins, then in addition to the skin map of the virtual character, an additional 19 diffuse maps and 19 normal maps are required to realize the skin changes. As the number of virtual character skin types increases, the game resource package will become larger, which may lead to restrictions on game development. Summary of the invention
[0004] The embodiment of the present application provides a method for adjusting the skin of a virtual character to solve the problem in the prior art that when implementing different skins for virtual characters, the game resource package is too large, resulting in restrictions on game development.
[0005] Correspondingly, the embodiment of the present application also provides a virtual character skin adjustment device to ensure the implementation and application of the above method.
[0006] In order to solve the above problems, an embodiment of the present application discloses a method for adjusting the skin of a virtual character, wherein the content displayed by the graphical user interface provided by the terminal device includes at least one virtual character, and the method comprises:
[0007] Acquire skin parameters corresponding to the virtual character, wherein the skin parameters include at least one of the following: a lightness parameter, a glossiness parameter, a color power parameter, and a contrast parameter;
[0008] According to the skin parameters, the RGB color value of each pixel in the skin map of the virtual character is adjusted to determine the skin color of the virtual character.
[0009] Optionally, the skin parameter includes a light and dark parameter, and adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes:
[0010] Convert the preset RGB color value to HSV color value;
[0011] Replace the brightness value in the HSV color value with the brightness parameter;
[0012] Convert the replaced HSV color value to a target RGB color value;
[0013] The target RGB color value is multiplied by the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value.
[0014] Optionally, the method further comprises:
[0015] When the brightness parameter is smaller than the preset brightness range, the brightness parameter is adjusted to be within the preset brightness range.
[0016] Optionally, the skin parameter includes a glossiness parameter, and adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes:
[0017] Multiplying the glossiness parameter by a preset multiple to obtain a target glossiness parameter;
[0018] Performing interpolation processing on the preset roughness range parameters according to the target glossiness parameter to obtain a roughness coefficient;
[0019] Get the roughness parameter of the shader;
[0020] Multiplying the roughness coefficient by the roughness parameter to obtain a target roughness;
[0021] According to the target roughness parameter, the RGB color value of each pixel in the skin map of the virtual character is adjusted.
[0022] Optionally, the method further comprises:
[0023] Performing interpolation processing in a preset highlight range according to the glossiness parameter to obtain a minimum highlight value;
[0024] Taking the highlight parameter as the highlight maximum value, and taking the middle value between the highlight minimum value and the highlight maximum value as the target highlight parameter;
[0025] According to the target highlight parameter, the RGB color value of each pixel in the skin map of the virtual character is adjusted.
[0026] Optionally, the skin parameter includes a color power parameter, and adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes:
[0027] The color power parameter power of each color component of the RGB color value of each pixel in the skin map of the virtual character is obtained to obtain an adjusted RGB color value of each pixel in the skin map of the virtual character.
[0028] Optionally, the skin parameter includes a contrast parameter, and adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes:
[0029] determining a contrast range according to the contrast parameter;
[0030] According to each color component of the RGB color value of each pixel in the skin map of the virtual character, interpolation processing is performed within the contrast range to obtain the interpolated RGB color component.
[0031] Optionally, the method further comprises:
[0032] When the color component after interpolation is less than a preset minimum value, setting the color component to the preset minimum value;
[0033] When the color component after interpolation is greater than a preset maximum value, the color component is set to the preset maximum value.
[0034] The embodiment of the present application further discloses a virtual character skin adjustment device, wherein the content displayed by the graphical user interface provided by the terminal device includes at least one virtual character, and the device includes:
[0035] A skin parameter acquisition module, used to acquire skin parameters corresponding to the virtual character, wherein the skin parameters include at least one of the following: a lightness parameter, a glossiness parameter, a color power parameter, and a contrast parameter;
[0036] The skin adjustment module is used to adjust the RGB color value of each pixel in the skin map of the virtual character according to the skin parameters to determine the skin color of the virtual character.
[0037] The present application also discloses an electronic device, including:
[0038] one or more processors; and
[0039] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the electronic device to perform one or more of the methods described above.
[0040] The embodiments of the present application also disclose one or more machine-readable media on which instructions are stored, which, when executed by one or more processors, enable the processors to perform one or more of the methods described above.
[0041] The embodiments of the present application include the following advantages:
[0042] In an embodiment of the present application, for the content displayed by the graphical user interface provided by the terminal device including a virtual character, the skin parameters corresponding to the virtual character can be obtained, wherein the skin parameters include at least one of the following: light and shade parameters, glossiness parameters, color power parameters, and contrast parameters, and then the RGB color value of each pixel in the skin map of the virtual character is adjusted according to the skin parameters, so that virtual characters with different skin colors can be obtained. In an embodiment of the present application, the skin parameters are introduced to realize the control of the skin color of the virtual character. Different virtual characters only need to realize different skin colors according to different skin parameters, which can avoid the game resource package from being too large, making the game development restrictions smaller. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 is a flowchart of a method for adjusting the skin of a virtual character according to an embodiment of the present application;
[0045] Figure 2 It is a structural block diagram of an embodiment of a virtual character skin adjustment device of the present application. DETAILED DESCRIPTION
[0046] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0047] The virtual character skin adjustment method in the embodiment of the present application can be run on a terminal device or a server. The terminal device can be a local terminal device. When the virtual character skin adjustment method is run on a server, it can be a cloud game.
[0048] In an optional implementation, cloud gaming refers to a gaming method based on cloud computing. In the operation mode of cloud gaming, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the virtual character skin adjustment method are completed on the cloud gaming server. The role of the cloud gaming client is used for receiving and sending data and presenting the game screen. For example, the cloud gaming client can be a display device with data transmission function close to the user side, such as a mobile terminal, a television, a computer, a handheld computer, etc.; but the terminal device for processing game data is a cloud gaming server in the cloud. When playing the game, the player operates the cloud gaming client to send operation instructions to the cloud gaming server. The cloud gaming server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the cloud gaming client through the network. Finally, the cloud gaming client decodes and outputs the game screen.
[0049] In an optional embodiment, the terminal device may be a local terminal device. The local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0050] Reference Figure 1 , shows a flowchart of a method for adjusting the skin of a virtual character according to an embodiment of the present application, wherein the content displayed by the graphical user interface provided by the terminal device includes at least one virtual character, and the method includes:
[0051] Step 101, obtaining skin parameters corresponding to the virtual character, wherein the skin parameters include at least one of the following: a lightness parameter, a glossiness parameter, a color power parameter, and a contrast parameter.
[0052] Step 102: adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter to determine the skin color of the virtual character.
[0053] Among them, the light and dark parameter (Light / Dark) is used to control the brightness of the skin, that is, the whiteness and blackness of the skin; the glossiness parameter (Gloss) is used to control the glossiness of the skin; the color power parameter (Power) is used to change the brightness and saturation of the skin as a whole; the contrast parameter (Contract) is used to modify the contrast.
[0054] In an embodiment of the present application, for a virtual character displayed by a graphical user interface provided by a terminal device, skin parameters corresponding to the virtual character can be obtained, and then the RGB color value of each pixel in the skin map of the virtual character is adjusted according to the skin parameters, so that virtual characters with different skin colors can be obtained. In an embodiment of the present application, skin parameters are introduced to control the skin color of the virtual character. Different virtual characters only need to have different skin colors according to different skin parameters, which can avoid the game resource package from being too large, making the game development restrictions smaller.
[0055] Next, the virtual character skin adjustment method in this exemplary embodiment is further described.
[0056] Step 101, obtaining skin parameters corresponding to the virtual character.
[0057] A game application is run on a terminal device, and a graphical user interface is rendered on a touch display of the terminal device. The content displayed by the graphical user interface at least partially includes a part or all of a game scene. The specific shape of the game scene can be a square or other shapes (for example, a circle, etc.).
[0058] Specifically, the game scene includes at least one virtual character, and the virtual character can be a person, an animal, an object, or a mecha, etc. The virtual character can be a game virtual character controlled by a player through a terminal device, a game virtual character controlled by an enemy player, or a non-player-controlled virtual character (Non-Practicing Character, NPC) pre-set by a game developer in a specific game scene, and can be presented through a graphical user interface, and the presented content can include all of the virtual character or part of the virtual character. For example, in a third-person perspective game, the content presented by the graphical user interface can include all of the virtual character, or in a first-person perspective game, the content presented by the graphical user interface can include part or part of the virtual character.
[0059] In the embodiment of the present application, the skin parameters can be set to different parameters according to the requirements. Among them, the skin parameters can be pre-set by the game developer for a specific game scene, or can be set by the player during the game for a specific game scene. The embodiment of the present application does not need to limit this.
[0060] Step 102: adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter to determine the skin color of the virtual character.
[0061] The virtual character in the embodiment of the present application has a corresponding game character model, and the game character model is provided with a skin map, which may include a diffuse reflection map and a normal map. Among them, the diffuse reflection map reflects the color and intensity of the object surface (such as the virtual character skin) under diffuse reflection, showing the inherent color and texture of the object. It is the most basic map of the object and can usually be directly understood as a texture. The normal map saves the normal vector of each pixel point on the surface of the object, and each component of the normal vector is saved in a color component of the RGB color value of each pixel in the skin map.
[0062] After obtaining the skin parameters of each virtual character, the shader of the terminal device will adjust the RGB color value of each pixel in the skin map of the corresponding virtual character according to the skin parameters, so that virtual characters with different skin colors can be presented in the game scene. Specifically, the skin color that can be adjusted by the skin parameters in the embodiment of the present application includes but is not limited to the brightness, glossiness, saturation and contrast of the skin map, and can adjust one or more skin colors at the same time or only adjust one or more skin colors.
[0063] In an optional embodiment of the present application, the skin parameter includes a light and dark parameter. Step 102, adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter, includes:
[0064] Convert the preset RGB color value to HSV color value;
[0065] Replace the brightness value in the HSV color value with the brightness parameter;
[0066] Convert the replaced HSV color value to a target RGB color value;
[0067] The target RGB color value is multiplied by the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value.
[0068] Among them, the lightness parameter (Light / Dark) is used to control the brightness of the skin, that is, the whiteness and blackness of the skin.
[0069] The color spaces involved in skin adjustment in the embodiments of the present application include HSV color space and RGB color space, wherein the HSV color space is a color space created based on the intuitive characteristics of color, also known as the hexagonal cone model (Hexcone Model), and the RGB color space is based on the three color components of R (Red), G (Green), and B (Blue), which are superimposed to varying degrees to produce rich and wide colors, commonly known as the three-primary color model.
[0070] In the embodiment of the present application, the RGB color value of white (the RGB color value with the highest brightness) is used as the preset RGB color value and converted into an HSV color value, and then the value of the brightness (V) in the HSV color value is changed based on the brightness parameter and converted back into an RGB color value, and finally multiplied with the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value, thereby completing the adjustment of the brightness of the skin map of the virtual character.
[0071] In an optional embodiment of the present application, the method further includes:
[0072] When the brightness parameter is smaller than the preset brightness range, the brightness parameter is adjusted to be within the preset brightness range.
[0073] The value range of the light and dark parameter can be mapped to 0-1, where 1 represents the brightest brightness and 0 represents the darkest brightness. In practical applications, game developers usually do not want the brightness of the virtual character's skin map to be too dark, such as the brightness below 0.5. Therefore, the embodiment of the present application can set 0.5-1 as the preset brightness range. Before adjusting the brightness of the virtual character's skin map based on the light and dark parameter, it will first be determined whether the size of the light and dark parameter is less than 0.5. If it is greater than 0.5, no processing is required. If it is less than 0.5, the light and dark parameter can be adjusted to within 0.5-1 in proportion or in other ways, so that the brightness of the virtual character's skin map is not too dark.
[0074] In an optional example, the code for adjusting the brightness of the virtual character's skin map may be:
[0075]
[0076]
[0077] In the above code, the light and dark parameter cHSV_V_Value is first defined, and then cHSV_V_Value is used as an interpolation percentage to map it from the range of 0 to 1 to the new light and dark parameter r_V_Value in the range of 1 to 0.5. This is because the game developer does not want the brightness to be lower than 0.5, so the brightness is set at 1 to 0.5. Then the white RGB color is converted into an HSV color value, and r_V_Value is directly used to replace the V (brightness) in HSVL. Finally, the HSV color value after replacing V is converted to an RGB color value, and multiplied with the RGB color value of each pixel in the virtual character's skin map, so as to change the skin color of the virtual character's skin map brightness.
[0078] In an optional embodiment of the present application, the skin parameter includes a glossiness parameter. Step 102, adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter, includes:
[0079] Multiplying the glossiness parameter by a preset multiple to obtain a target glossiness parameter;
[0080] Performing interpolation processing on the preset roughness range parameters according to the target glossiness parameter to obtain a roughness coefficient;
[0081] Get the roughness parameter of the shader;
[0082] Multiplying the roughness coefficient by the roughness parameter to obtain a target roughness;
[0083] According to the target roughness parameter, the RGB color value of each pixel in the skin map of the virtual character is adjusted.
[0084] Among them, the skin parameter (Gloss) is used to control the glossiness of the skin, which can specifically include the glossiness parameter cShine. Based on the glossiness parameter cShine, the Roughness parameter of the shader can be modified. Specifically, the role of the roughness parameter is to control whether the surface of the object is rougher or smoother. After modifying the roughness parameter of the shader, the shader will adjust the RGB color value of each pixel in the skin map of the virtual character according to the roughness parameter, and obtain the adjusted RGB color value, thereby completing the adjustment of the roughness of the skin map of the virtual character.
[0085] In an optional example, the code for adjusting the roughness of the virtual character's skin can be:
[0086] Roughness=lerp(1.847619, 1.35, cShine*1.1)*Roughness;
[0087] In the above code, a preset roughness range is used. In this preset roughness range, the glossiness parameter cShine is used as an interpolation percentage to get the roughness coefficient, and then multiplied by the roughness parameter Roughness to calculate the new roughness parameter. Among them, the preset roughness range is 1.847619 and 1.35, which is a reasonable range considered by the artists during the adjustment process. 1.1 times the glossiness parameter cShine is the target glossiness parameter that can amplify the adjustment effect.
[0088] In an optional embodiment of the present application, the method further includes:
[0089] Performing interpolation processing in a preset highlight range according to the glossiness parameter to obtain a minimum highlight value;
[0090] Taking the highlight parameter as the highlight maximum value, and taking the middle value between the highlight minimum value and the highlight maximum value as the target highlight parameter;
[0091] According to the target highlight parameter, the RGB color value of each pixel in the skin map of the virtual character is adjusted.
[0092] Among them, based on the glossiness parameter cShine, the Specular (mirror reflection intensity parameter or highlight parameter) in the shader calculation can also be modified. Specifically, the highlight parameter is used to control the ability of the object surface to reflect light. The larger the highlight parameter, the stronger the ability to reflect light, and the smaller the highlight parameter, the weaker the ability to reflect light. After modifying the highlight parameter in the shader, the shader will adjust the RGB color value of each pixel in the virtual character's skin map according to the highlight parameter, and obtain the adjusted RGB color value, thereby completing the adjustment of the highlight of the virtual character's skin map.
[0093] In an optional example, the code for adjusting the highlight of the virtual character's skin map can be:
[0094] float cShine:layout(ps)<Widget="FloatSlider";Min="0";Max="1";Step="0.01";Precision="2";> =0.25;
[0095] / / Shine orroughness calculation
[0096] Roughness=lerp(1.847619, 1.35, cShine*1.1)*Roughness;
[0097] halfspecularMin = lerp (0, 2.0, cShine); / / Calculate the minimum highlight value of the highlight range through interpolation
[0098] halfspecularMax=2; / / Maximum value of the fixed highlight range
[0099] IMP.Specular = lerp(specularMin, specularMax, 0.5); / / Take the middle value of the highlight range as the final target highlight parameter
[0100] In the above code, a preset highlight range is used. In this preset highlight range, the glossiness parameter cShine is used as the interpolation percentage to get the minimum highlight value, and then the glossiness parameter cShine is used as the maximum highlight value. Then, according to 0.5, the minimum highlight value and the maximum highlight value are interpolated to get the middle value, which is used as the target highlight parameter when the shader processes the skin map.
[0101] In an optional embodiment of the present application, the skin parameter includes a color power parameter, and the step 102 of adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes:
[0102] The color power parameter power of each color component of the RGB color value of each pixel in the skin map of the virtual character is obtained to obtain an adjusted RGB color value of each pixel in the skin map of the virtual character.
[0103] The color power parameter (Power) is used to change the brightness and saturation of the skin as a whole. The RGB color value of each pixel in the skin map is raised to the power based on the color power parameter, that is, each color component of the RGB color value is raised to the power of Power: R = R Power , G=R Power , B=B Power , and obtain the adjusted RGB color value, thereby completing the adjustment of the overall brightness and saturation of the virtual character's skin map.
[0104] In an optional example, the code for adjusting the overall brightness and saturation of the virtual character's skin map may be:
[0105] float cPower:layout(ps)<Widget="FloatSlider";Min="0.5";Max="2";Step="0.01";Precision="2";> =1; / / Power
[0106] BaseColor.rgb = pow (BaseColor.rgb, cPower); / / Raise the Power of each component of the RGB color value of the pixel
[0107] In the above code, for each color component in the RGB color value of the pixel, that is, the R component, the G component, and the B component, a power calculation is performed based on Power.
[0108] In an optional embodiment of the present application, the skin parameter includes a contrast parameter, and the step 102 of adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes:
[0109] determining a contrast range according to the contrast parameter;
[0110] According to each color component of the RGB color value of each pixel in the skin map of the virtual character, interpolation processing is performed within the contrast range to obtain the interpolated RGB color component.
[0111] Among them, the contrast parameter (Contract) is used to modify the contrast. In an optional example, the contrast modification can be implemented using the CheapContract_RGB (low-cost contrast_RGB) function. Specifically, the CheapContrast_RGB function improves the contrast of the skin map by remapping the high end of the color histogram to the low end value, and then remapping the low end of the color histogram to the high end value.
[0112] Specifically, the embodiment of the present application can obtain a contrast range based on a contrast parameter, and then interpolate each color component of the RGB color value of each pixel in the skin map of the virtual character within the contrast range to obtain the interpolated RGB color component and the adjusted RGB color value, thereby completing the contrast adjustment of the virtual character's skin map.
[0113] In an optional embodiment of the present application, the method further includes:
[0114] When the color component after interpolation is less than a preset minimum value, setting the color component to the preset minimum value;
[0115] When the color component after interpolation is greater than a preset maximum value, the color component is set to the preset maximum value.
[0116] In the aforementioned interpolation calculation process, it may happen that the interpolated color component is not within the range of the preset minimum value and the preset maximum value, that is, within 0-1. In practice, the color component can only take 0-1 in the end. Therefore, for the interpolated color component, if the color component is less than the preset minimum value, the color value is set to the preset minimum value. If the color component is greater than the preset maximum value, the color value is set to the preset maximum value.
[0117] In an optional example, the code for adjusting the contrast of the virtual character's skin may be:
[0118]
[0119]
[0120] In the above code, the adjustable range of the contrast parameter cContrast is -0.5 to 1. Then the Lerp function of each color component in the RGB color value performs a Lerp (linear interpolation) operation. The first parameter in the contrast range of the Lerp function is 0.5 to -1 (-cContrast), and the second parameter in the contrast range is 0.5 to 2 (cContrast+1):
[0121] lerp(ret.r, contrast+1, diffuseColor.r);
[0122] Each color component of diffuseColor (diffuse map) is interpolated within the two parameters of the Lerp function. When cContrast is -0.5, each color component can only get a value of 0.5 after Lerp (because the first two parameters of Lerp are both 0.5). The larger the cContrast is, the more each color component will be expanded from (0 to 1) to (-1 to 2) after Lerp. However, since the color component can only take the value of 0 to 1 in the end, the color components outside this range will be limited to the range of 0 to 1 by the clamp function. Specifically, each color component in the final diffuseColor will become 0 if it is less than 0, and will become 1 if it is greater than 1. That is, the bright areas in the skin map become brighter, and the dark areas become darker, thereby improving the contrast of the skin map.
[0123] The embodiment of the present application includes 4 skin parameters, namely 1. Contract: modifying contrast; 2. Power: color power of the color components of the RGB color value; 3. Light / Dark: controlling the whiteness and blackness of the skin; 4. Gloss: controlling the glossiness of the skin. Among them, the skin colors of the 4 skin parameters are independent of each other, and each skin parameter corresponds to an adjustment of the skin color. Since the 4 skin parameters will affect the final RGB color value of each pixel of the object, they usually need to be adjusted in a certain order, such as the order above. Of course, precisely because each skin parameter corresponds to an adjustment of the skin color, the skin color can be adjusted independently based on the skin parameter, or the RGB color value of each pixel can be adjusted in other orders.
[0124] The application of the embodiment of the present application greatly reduces the increase in game resource packages caused by skin changes. Assuming that a skin map is 1024*1024, the size of a skin map is 4*1024*1024B, that is, 4MB. 4 The amount of resources required for each skin color is very large, and this application can combine nearly 100 skin colors by using 4 skin parameters instead of repeated skin maps.4 If a player has a different skin color and the space in the game resource package required is very small, there will be more remaining space in the game resource package, which will reduce the restrictions on game development.
[0125] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0126] Reference Figure 2 , showing a structural block diagram of an embodiment of a device for adjusting the skin of an object of the present application, wherein the content displayed by the graphical user interface provided by the terminal device includes at least one virtual character, and the device includes:
[0127] The skin parameter acquisition module 201 is used to acquire skin parameters corresponding to the virtual character, wherein the skin parameters include at least one of the following: a lightness parameter, a glossiness parameter, a color power parameter, and a contrast parameter;
[0128] The skin adjustment module 202 is used to adjust the RGB color value of each pixel in the skin map of the virtual character according to the skin parameters to determine the skin color of the virtual character.
[0129] In an optional embodiment of the present application, the skin parameters include light and dark parameters, and the skin adjustment module 202 is used to convert a preset RGB color value into an HSV color value; replace the brightness value in the HSV color value with the light and dark parameter; convert the replaced HSV color value into a target RGB color value; multiply the target RGB color value with the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value.
[0130] In an optional embodiment of the present application, the skin adjustment module 202 is used to adjust the size of the brightness parameter to within the preset brightness range when the brightness parameter is smaller than the preset brightness range.
[0131] In an optional embodiment of the present application, the skin parameters include a glossiness parameter, and the skin adjustment module 202 is used to multiply the glossiness parameter by a preset multiple to obtain a target glossiness parameter; perform interpolation processing in a preset roughness range parameter according to the target glossiness parameter to obtain a roughness coefficient; obtain a roughness parameter of the shader; multiply the roughness coefficient by the roughness parameter to obtain a target roughness; and adjust the RGB color value of each pixel in the skin map of the virtual character according to the target roughness parameter.
[0132] In an optional embodiment of the present application, the skin adjustment module 202 is used to perform interpolation processing in a preset highlight range according to the glossiness parameter to obtain a minimum highlight value; take the highlight parameter as the maximum highlight value, and take the intermediate value between the minimum highlight value and the maximum highlight value as the target highlight parameter; and adjust the RGB color value of each pixel in the skin map of the virtual character according to the target highlight parameter.
[0133] In an optional embodiment of the present application, the skin parameters include color power parameters, and the skin adjustment module 202 is used to calculate the color power parameter power of each color component of the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value of each pixel in the skin map of the virtual character.
[0134] In an optional embodiment of the present application, the skin parameters include contrast parameters, and the skin adjustment module 202 is used to determine a contrast range based on the contrast parameters; and to perform interpolation processing within the contrast range according to each color component of the RGB color value of each pixel in the skin map of the virtual character to obtain the interpolated RGB color components.
[0135] In an optional embodiment of the present application, the skin adjustment module 202 is used to set the color component to the preset minimum value when the color component after interpolation is less than the preset minimum value; when the color component after interpolation is greater than the preset maximum value, set the color component to the preset maximum value.
[0136] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0137] The present application also provides an electronic device, including:
[0138] one or more processors; and
[0139] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to execute the method described in the embodiments of the present application.
[0140] The embodiments of the present application also provide one or more machine-readable media on which instructions are stored, which, when executed by one or more processors, enable the processors to execute the methods described in the embodiments of the present application.
[0141] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0142] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0144] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0145] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0146] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0147] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0148] The above is a detailed introduction to a virtual character skin adjustment method and a virtual character skin adjustment device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for adjusting the skin of a virtual character, characterized in that: The method comprises: Running a game application to display a partial or complete game scene, wherein the game scene includes at least one virtual character, the virtual character has a corresponding game character model, and the game character model is provided with a skin map, wherein the skin map includes a diffuse reflection map and a normal map; Acquire skin parameters corresponding to the virtual character, the skin parameters including at least one of the following: a light and shade parameter, a glossiness parameter, a color power parameter, and a contrast parameter; wherein the light and shade parameter is used to control the brightness of the skin, the glossiness parameter is used to control the glossiness of the skin, the color power parameter is used to change the brightness and saturation of the skin as a whole, and the contrast parameter is used to modify the contrast; According to the skin parameters, the RGB color value of each pixel in the skin map of the virtual character is adjusted in a preset order to adjust the brightness, the glossiness, the saturation and the contrast of the skin map respectively, and determine the skin color of the virtual character; Displaying a virtual character with the skin color in the game application, so that virtual characters with different skin colors are presented in the game scene; Wherein, when the skin parameter includes a light and dark parameter, adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes: Convert the preset RGB color value to HSV color value; Replace the brightness value in the HSV color value with the brightness parameter; Convert the replaced HSV color value to a target RGB color value; Multiplying the target RGB color value by the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value; When the skin parameter includes a glossiness parameter, adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes: Multiplying the glossiness parameter by a preset multiple to obtain a target glossiness parameter; Performing interpolation processing on the preset roughness range parameters according to the target glossiness parameter to obtain a roughness coefficient; Get the roughness parameter of the shader; Multiplying the roughness coefficient by the roughness parameter to obtain a target roughness; According to the target roughness parameter, adjusting the RGB color value of each pixel in the skin map of the virtual character; Performing interpolation processing in a preset highlight range according to the glossiness parameter to obtain a minimum highlight value; Taking the highlight parameter as the highlight maximum value, and taking the middle value between the highlight minimum value and the highlight maximum value as the target highlight parameter; According to the target highlight parameter, the RGB color value of each pixel in the skin map of the virtual character is adjusted.
2. The method according to claim 1, characterized in that The method further comprises: When the brightness parameter is smaller than the preset brightness range, the brightness parameter is adjusted to be within the preset brightness range.
3. The method according to claim 1, characterized in that The skin parameter includes a color power parameter, and adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes: The color power parameter power of each color component of the RGB color value of each pixel in the skin map of the virtual character is obtained to obtain an adjusted RGB color value of each pixel in the skin map of the virtual character.
4. The method according to claim 1, characterized in that: The skin parameter includes a contrast parameter, and adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameter includes: determining a contrast range according to the contrast parameter; According to each color component of the RGB color value of each pixel in the skin map of the virtual character, interpolation processing is performed within the contrast range to obtain the interpolated RGB color component.
5. The method according to claim 4, characterized in that The method further comprises: When the color component after interpolation is less than a preset minimum value, setting the color component to the preset minimum value; When the color component after interpolation is greater than a preset maximum value, the color component is set to the preset maximum value.
6. A virtual character skin adjustment device, characterized in that: The content displayed by the graphical user interface provided by the terminal device includes at least one virtual character, and the apparatus includes: A skin parameter acquisition module, used to run a game application, display a partial or complete game scene, wherein the game scene includes at least one of the virtual characters, the virtual character has a corresponding game character model, the game character model is provided with a skin map, the skin map includes a diffuse map and a normal map, and obtain skin parameters corresponding to the virtual character, wherein the skin parameters include at least one of the following: a light and shade parameter, a glossiness parameter, a color power parameter, and a contrast parameter, wherein the light and shade parameter is used to control the brightness of the skin, the glossiness parameter is used to control the glossiness of the skin, the color power parameter is used to change the brightness and saturation of the skin as a whole, and the contrast parameter is used to modify the contrast; A skin adjustment module, for adjusting the RGB color value of each pixel in the skin map of the virtual character according to the skin parameters and in a preset order, so as to adjust the brightness, the glossiness, the saturation and the contrast of the skin map respectively, and determine the skin color of the virtual character, display the virtual character of the skin color in the game application, and obtain virtual characters of different skin colors presented in the game scene; Wherein, when the skin parameter includes a light and dark parameter, the skin adjustment module is used to convert a preset RGB color value into an HSV color value; replace the brightness value in the HSV color value with the light and dark parameter; convert the replaced HSV color value into a target RGB color value; multiply the target RGB color value by the RGB color value of each pixel in the skin map of the virtual character to obtain the adjusted RGB color value; When the skin parameters include a glossiness parameter, the skin adjustment module is used to multiply the glossiness parameter by a preset multiple to obtain a target glossiness parameter; perform interpolation processing in a preset roughness range parameter according to the target glossiness parameter to obtain a roughness coefficient; obtain the roughness parameter of the shader; multiply the roughness coefficient by the roughness parameter to obtain a target roughness; adjust the RGB color value of each pixel in the skin map of the virtual character according to the target roughness parameter; perform interpolation processing in a preset highlight range according to the glossiness parameter to obtain a minimum highlight value; use the highlight parameter as the maximum highlight value, and take the intermediate value between the minimum highlight value and the maximum highlight value as the target highlight parameter; adjust the RGB color value of each pixel in the skin map of the virtual character according to the target highlight parameter.
7. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the electronic device to perform one or more methods as described in any one of claims 1-5.
8. One or more machine-readable media having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform one or more methods as claimed in any one of claims 1 to 5.
