A real-time game character and clothing dyeing method
By modifying the dyeing control parameters and performing color decontamination and saturation adjustment of pixel points in game development, the problem of insufficient color effects and high GPU calculation complexity in the existing technology is solved, and efficient and rich coloring effects of game characters and clothing are achieved.
Patent Information
- Application Number
- CN202410626066.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-05-20
AI Technical Summary
The existing real-time game character and clothing dyeing methods have not been rich enough, the color range is limited, and the GPU computing complexity is relatively high, which affects the game operation efficiency and player experience.
By modifying the dyeing control parameters passed to the GPU in the client's CPU, including the dyeing color, the color decolorization degree of the primary color and the saturation adjustment parameters, the color decolorization calculation and saturation adjustment of pixel points are performed in the GPU to obtain the final dyeing color.
It realizes the reduction of GPU computing complexity while maintaining rich dyeing effects, improving game operation efficiency, providing a better user experience, and reducing the cost of game developers.
Smart Images

Figure CN118491089B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of game development, and in particular to a real-time game character and clothing dyeing method. Background Art
[0002] As electronic games mature, including online games and stand-alone games running on mobile phones, personal computers, game consoles and other devices, customizable game characters have become an important means to attract players. Among them, the coloring function of various parts of the character's body, clothing, etc. is an important part of character customization.
[0003] The traditional real-time dyeing algorithm is a dyeing method based on the material system. When the GPU calculates the pixel color in the game screen, the hue, saturation and brightness of the original color are adjusted, that is, the HSL color (referring to the color represented by hue, saturation and brightness) and RGB color (referring to the color represented by the three primary colors of red, green and blue) are converted to each other to achieve the dyeing function. This method can meet the most basic dyeing function, but the color effect produced is not rich enough, the color range is limited, and there is a problem of high GPU calculation complexity in real-time calculation, which affects the player experience in terms of picture performance and game operation efficiency. Therefore, this application provides a real-time game character and clothing dyeing method to meet the needs. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a real-time game character and clothing dyeing method to solve the problems of insufficient color effects, limited color range and high GPU calculation complexity.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] A real-time game character and clothing dyeing method, comprising the following steps:
[0007] S1.1, the client responds to commands for controlling game characters and clothing dyeing;
[0008] S1.2, the CPU modifies the shading control parameters passed to the GPU through the material system;
[0009] S2.1, in the GPU, by reading a mask map in the material of the character or clothing, it is determined whether the pixel currently being calculated needs to be dyed;
[0010] S2.2, calculating the saturation of the current pixel, recording the result as the primary color saturation, calculating the saturation of the dyed color, and recording the result as the dyed color saturation;
[0011] S2.3, performing decolorization calculation on the current pixel point, and interpolating the decolorization result with the original color according to the decolorization degree of the parameter original color;
[0012] S2.4, multiplying the result of the decolorization calculation by the dyeing color, and adjusting the color saturation to obtain a preliminary dyeing color;
[0013] S2.5, according to the saturation adjustment parameter, interpolation calculation is performed between the primary color saturation and the dyeing saturation to obtain the target saturation;
[0014] S2.6, modifying the saturation of the preliminary dyeing color to a final saturation by calculation to obtain a final color;
[0015] S3, passes the final color as the calculation result to be used in other subsequent pixel color calculations, or directly outputs it and displays it on the screen.
[0016] In a possible implementation, the control parameters in S1.2 include tinting color, decolorization degree of primary color, and saturation adjustment parameters.
[0017] In a possible implementation, the calculation method of the saturation in 2.2 is Saturate = 1-(minimum brightness among primary colors RGB / maximum brightness among primary colors RGB).
[0018] In a possible implementation, the calculation method of the decolorization in S2.3 is: decolorization color=dot{original color, fl oat3(0.3, 0.59, 0.11)}.
[0019] In a possible implementation, the calculation method for adjusting the saturation in S2.4 is: setting the corresponding channel value of the minimum brightness in the primary color RGB to 0, and setting the corresponding channel value of the maximum brightness in the primary color RGB to 1.
[0020] In a possible implementation, the calculation method of the saturation modification in 2.6 is: final color = pure white (1) * final saturation + preliminary dyeing color * (1-final saturation).
[0021] Compared with the prior art, the present invention has at least the following beneficial effects:
[0022] By optimizing the algorithm for converting HSL colors to RGB colors, using simple multiplication to simplify the complex hue transformation calculations and completing the brightness calculations at the same time, the details lost due to the simplification algorithm are merged into the saturation calculation, thus taking into account both performance consumption and effect details without incurring additional production costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which are incorporated herein and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, further serve to explain the principles of the present disclosure and to enable those skilled in the relevant art to make and use the present disclosure.
[0024] Figure 1 This is the overall flow chart of S2 of the present invention.
[0025] As shown in the figure, in order to clearly implement the structure of the embodiment of the present invention, specific structures and devices are marked in the figure, but this is only for illustrative purposes and is not intended to limit the present invention to the specific structure, device and environment. According to specific needs, ordinary technicians in this field can adjust or modify these devices and environments, and the adjustments or modifications made are still included in the scope of the attached claims. DETAILED DESCRIPTION
[0026] The following is a detailed description of a real-time game character and clothing dyeing method provided by the present invention in conjunction with the accompanying drawings and specific embodiments. At the same time, it is explained here that in order to make the embodiments more detailed, the following embodiments are the best and preferred embodiments, and those skilled in the art may also adopt other alternatives to implement some known technologies; and the accompanying drawings are only for more specific description of the embodiments, and are not intended to specifically limit the present invention.
[0027] It should be noted that the references to "one embodiment", "embodiment", "exemplary embodiments", "some embodiments" and the like in the specification indicate that the embodiments described may include specific features, structures or characteristics, but not every embodiment may include the specific features, structures or characteristics. In addition, when a specific feature, structure or characteristic is described in conjunction with an embodiment, it should be within the knowledge of a person skilled in the art to implement such feature, structure or characteristic in conjunction with other embodiments (whether or not explicitly described).
[0028] In general, a term can be understood, at least in part, from its use in context. For example, depending, at least in part, on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in the singular sense, or can be used to describe a combination of features, structures, or characteristics in the plural sense. Additionally, the term "based on" can be understood as not necessarily intended to convey an exclusive set of factors, but rather can be alternative, depending, at least in part, on the context, allowing for the presence of other factors that are not necessarily explicitly described.
[0029] It will be understood that the meaning of “on,” “over,” and “above” in this disclosure should be interpreted in the broadest manner, so that “on” means not only “directly on” something, but also includes the meaning of being “on” something with intervening features or layers therebetween, and “on” or “over” means not only “on” or “above” something, but also includes the meaning of being “on” or “above” something with no intervening features or layers therebetween.
[0030] Additionally, spatially relative terms such as "under," "beneath," "lower," "above," "upper," and the like may be used herein for descriptive convenience to describe the relationship of one element or feature to another element or features, as shown in the accompanying drawings. Spatially relative terms are intended to encompass different orientations of the device in use or operation in addition to the orientation depicted in the accompanying drawings. The device may be oriented in other ways, and the spatially relative descriptors used herein may be similarly interpreted accordingly.
[0031] like Figure 1 As shown, an embodiment of the present invention provides a real-time game character and clothing dyeing method, comprising the following steps:
[0032] S1.1, the client responds to commands for controlling game characters and clothing dyeing;
[0033] S1.2, the CPU modifies the tinting control parameters passed to the GPU through the material system. The control parameters include tinting color, desaturation degree of the original color, and saturation adjustment parameters;
[0034] S2.1, in the GPU, by reading a mask map in the material of the character or clothing, it is determined whether the pixel currently being calculated needs to be dyed;
[0035] S2.2, calculate the saturation of the current pixel and the dyed color respectively by the calculation method of Saturate = 1-(minimum brightness in the primary color RGB / maximum brightness in the primary color RGB), record the saturation of the current pixel as the primary color saturation, and record the saturation of the dyed color as the dyed saturation;
[0036] S2.3, decolorizing the current pixel by using the calculation method of decolorizing color = dot{original color, fl oat3(0.3, 0.59, 0.11)}, and interpolating the decolorization result with the original color according to the decolorization degree of the original color parameter;
[0037] S2.4, multiplying the result of the decolorization calculation by the dyeing color, and adjusting the color saturation by setting the corresponding channel value of the minimum brightness in the primary color RGB to 0 and setting the corresponding channel value of the maximum brightness in the primary color RGB to 1, to obtain a preliminary dyeing color;
[0038] S2.5, according to the saturation adjustment parameter, interpolation calculation is performed between the primary color saturation and the dyeing saturation to obtain the target saturation;
[0039] S2.6, modifying the saturation of the preliminary dyeing color to the final saturation by the calculation method of final color = pure white (1) * final saturation + preliminary dyeing color * (1-final saturation) to obtain the final color;
[0040] S3, passes the final color as the calculation result to be used in other subsequent pixel color calculations, or directly outputs it and displays it on the screen.
[0041] The technical solution provided by the present invention can not only maintain high operating efficiency while maintaining sufficiently rich coloring effects and provide a better user experience, but also can effectively reduce costs for game developers.
[0042] The present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention. In order to make the public have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details. In addition, in order to avoid unnecessary confusion about the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.
[0043] A person skilled in the art will appreciate that all or part of the steps in the above-mentioned embodiment method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc.
[0044] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A real-time game character and clothing dyeing method, characterized in that: The following steps are involved: S1.1, the client responds to commands for controlling game characters and clothing dyeing; S1.2, the CPU modifies the tinting control parameters passed to the GPU through the material system; S2.1, in the GPU, by reading a mask map in the material of the character or clothing, it is determined whether the pixel currently being calculated needs to be dyed; S2.2, calculating the saturation of the current pixel, recording the result as the primary color saturation, calculating the saturation of the dyed color, and recording the result as the dyed color saturation; S2.3, performing decolorization calculation on the current pixel point, and interpolating the decolorization result with the original color according to the decolorization degree of the parameter original color; S2.4, multiplying the result of the decolorization calculation by the dyeing color, and adjusting the color saturation to obtain a preliminary dyeing color; S2.5, according to the saturation adjustment parameter, interpolation calculation is performed between the primary color saturation and the dyeing saturation to obtain the target saturation; S2.6, modifying the saturation of the preliminary dyeing color to a final saturation by calculation to obtain a final color; S3, passes the final color as the calculation result to be used in other subsequent pixel color calculations, or directly outputs it and displays it on the screen.
2. A real-time game character and clothing dyeing method according to claim 1, characterized in that: The control parameters in S1.2 include dyeing color, decolorization degree of primary color, and saturation adjustment parameters.
3. A real-time game character and clothing dyeing method according to claim 1, characterized in that: The calculation method of saturation in 2.2 is Saturate = 1-(minimum brightness in primary color RGB / maximum brightness in primary color RGB).
4. A real-time game character and clothing dyeing method according to claim 1, characterized in that: The calculation method of decolorization in S2.3 is: decolorization color=dot{original color, float3(0.3, 0.59, 0.11)}.
5. A real-time game character and clothing dyeing method according to claim 1, characterized in that: The calculation method of saturation adjustment in S2.4 is: setting the corresponding channel value of the minimum brightness in the primary color RGB to 0, and setting the corresponding channel value of the maximum brightness in the primary color RGB to 1.
6. A real-time game character and clothing dyeing method according to claim 1, characterized in that: The calculation method of the saturation modification in 2.6 is: final color = pure white (1) * final saturation + preliminary dyeing color * (1-final saturation).
Citation Information
Patent Citations
Game character staining method and device, user terminal and game system
CN105233498A
Color adjusting method and device for virtual object model
CN117379797A