Virtual character model color changing method and system, computer equipment and medium
By using vertex color information encoding and multi-level interpolation calculation of color-changing channel maps, the problem of dynamic smooth transition and detail adaptive processing in multi-region color changing of virtual characters is solved, achieving efficient and realistic character color changing effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN MAGIC NUMBER ENTERTAINMENT NETWORK TECH CO LTD
- Filing Date
- 2026-01-19
- Publication Date
- 2026-04-28
AI Technical Summary
Existing virtual character color-changing technology struggles to achieve dynamic and smooth transitions and adaptive detail processing in multi-area scenes, resulting in resource waste, insufficient visual fidelity, and low efficiency.
By acquiring the vertex color information, color-changing partition switch information, color-changing partition color array, and color-changing channel texture of the virtual character, the color-changing partition identifier is determined by encoding the vertex color information. Combined with multi-level interpolation calculation of the color-changing channel texture, smooth color transition and detailed control between partitions are achieved.
It improves the dynamic smooth transition and detail adaptive processing capabilities between multiple areas, reduces memory burden, enhances the realism and efficiency of color changing effects, and avoids the subjectivity and high cost of manual color adjustment.
Smart Images

Figure CN121937604A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of model rendering technology, and in particular to a method, system, computer device, and medium for changing the color of a virtual character model. Background Technology
[0002] With the rapid development of the gaming industry, players' demand for personalized customization of game characters has become increasingly prominent. Early games mostly used fixed skin appearances, but with technological advancements and the diversification of user aesthetics, modern games have gradually supported character customization functions, such as changing hairstyles, clothing, accessories, and partial color changes, allowing players to create unique appearances according to their personal preferences and enhance their social interaction experience.
[0003] In the field of character model color changing technology, existing methods mainly rely on two types of solutions: one is the masking and marking technology based on multi-channel maps, such as using an independent channel map for region identification for each color changing area. Although it can achieve basic color changing, as the number of regions increases, multiple textures need to be superimposed, leading to increased memory consumption and rendering performance burden. The other is the color level differentiation technology based on single-channel maps, such as using different color level values of a single channel map to divide multiple color changing areas. Although it can support a large number of regions, it does not support two-color gradient effects, and color overflow is prone to occur at the edges of regions, affecting visual fidelity. In addition, in order to maintain the texture details of the model after color changing, traditional methods require the creation of additional color changing detail maps. This is usually done by manually adjusting the colors of diffuse maps by desaturating them and then dividing them into sections. This method is greatly affected by the subjective factors of the operator, lacks stability, and the debugging process consumes a lot of manual labor costs.
[0004] Prior art document 1 (application publication number CN113223133A) discloses a 3D model color-changing method, which distinguishes the target area from other areas by generating a mask image, and then fills the mask with the target color before overlaying it onto the model to achieve color changing. Although this method can avoid changes in texture patterns, it mainly focuses on color changing operations in a single area and is difficult to support dynamic smooth transitions and adaptive detail processing between multiple areas. Specifically, existing technologies, including prior art document 1, lack an effective integration of gradient effects and detail fidelity mechanisms in multi-area color changing, resulting in the following prominent problems: on the one hand, in multi-area scenarios, existing methods cannot balance the number of textures and performance overhead, resulting in wasted resources; on the other hand, abrupt color transitions and overflow phenomena reduce the quality of color changing; at the same time, detail processing relies on manual intervention, which is inefficient and inconsistent. These problems combine to make it difficult for existing color-changing technologies to balance efficiency, quality, and stability, and cannot meet the actual needs of high-performance, high-fidelity dynamic color changing for characters in games. Therefore, existing character color-changing technologies cannot support dynamic smooth transitions and adaptive detail processing between multiple areas, which restricts the deepening and widespread application of game character customization functions. Summary of the Invention
[0005] In view of the above-mentioned shortcomings or disadvantages, the present invention provides a method, system, computer device and medium for changing the color of virtual character models, which can solve the technical problem that the prior art is unable to support dynamic smooth transition and detail adaptive processing between multiple regions.
[0006] This invention provides a method for recoloring a virtual character model, comprising: acquiring vertex color information, recolor partition switch information, a recolor partition color array, a diffuse map, and a recolor channel map of the virtual character. The vertex color information is encoded based on specific channel values to determine at least two recolor partition identifiers. The encoding process includes converting the channel values to integer format and determining the recolor partition identifiers through bitwise operations. The recolor enabling state of each recolor partition identifier is determined based on the switch state represented by the recolor partition switch information. The recolor enabling state refers to a Boolean state configuration indicating whether the recolor operation is enabled. Based on the recolor enabling state, the original color of the diffuse map, and the channel data of the recolor channel map, multi-level interpolation calculations are performed on the color values in the recolor partition color array to obtain the model rendering result. According to the model rendering result, a fragment shader is used to perform a rendering operation on the virtual character model to complete the recoloring.
[0007] This invention provides a virtual character model color-changing system according to a second aspect, comprising: a virtual character information acquisition module, used to acquire vertex color information, color-changing partition switch information, color-changing partition color array, diffuse map, and color-changing channel map of the virtual character; a color-changing partition identification marking module, used to perform encoding processing on the vertex color information according to specific channel values of the vertex color information to determine at least two color-changing partition identifiers, wherein the encoding processing includes converting the channel values into integer format and determining the color-changing partition identifiers through bitwise operations; a color-changing activation state recognition module, used to determine the color-changing activation state of the color-changing partition corresponding to each color-changing partition identifier according to the switch state represented by the color-changing partition switch information, wherein the color-changing activation state refers to a Boolean state configuration of whether the color-changing operation is enabled; a model rendering result generation module, used to perform multi-level interpolation calculations on the color values in the color-changing partition color array based on the color-changing activation state, the original color of the diffuse map, and the channel data of the color-changing channel map to obtain the model rendering result; and a model color-changing operation rendering module, used to perform rendering operations on the virtual character model through a fragment shader to complete the color-changing according to the model rendering result.
[0008] According to a third aspect, the present invention provides a computer device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a model color-changing method for any virtual character in an embodiment of the present invention.
[0009] According to another aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute a model color-changing method for any virtual character in the embodiments of the present invention.
[0010] The present invention provides a method for changing the color of a virtual character model. This method is achieved through five core steps: information acquisition, encoding processing, activation status judgment, multi-level interpolation calculation, and rendering operation. This process involves acquiring vertex color information, color-changing partition switch information, color-changing partition color arrays, diffuse maps, and color-changing channel maps of the virtual character to gather basic data resources required for model rendering; encoding the vertex color information based on specific channel values to determine at least two color-changing partition identifiers, including converting channel values to integer format and determining the color-changing partition identifiers through bitwise operations (binary operations), for compressed storage and efficient parsing of partition information; determining the color-changing enable status of each color-changing partition corresponding to the color-changing partition identifier based on the switch status represented by the color-changing partition switch information, where the color-changing enable status refers to the Boolean state (binary logic state) configuration of whether the color-changing operation is enabled, used to dynamically control the enabling conditions of the color-changing operation for each partition; performing multi-level interpolation calculations on the color values in the color-changing partition color array based on the color-changing enable status, the original color of the diffuse map, and the channel data of the color-changing channel map to obtain the model rendering result, used to generate intermediate rendering data that blends the original details and color-changing effects; and finally, according to the model rendering result, using a fragment shader ( This function performs rendering operations on the virtual character model to complete the color change, and is used to achieve the graphical output of the final color change effect.
[0011] In this technical solution, the present invention addresses the problem of insufficient multi-region support mentioned in the background technology by determining at least two color-changing partition identifiers through encoding processing based on vertex color information. This achieves bitwise compressed storage of partition information, solving the problem of increased memory burden caused by the increase in the number of regions in traditional multi-channel map methods. Regarding the issues of missing gradient effects and color overflow, multi-level interpolation calculations driven by channel data of the color-changing channel map are used to achieve smooth color transitions between partitions and edge overflow control. Addressing the problem of low efficiency in detail processing, the Boolean configuration of the color-changing enabled state and the collaborative processing of the original color of the diffuse map achieve stable color-changing details, avoiding the subjectivity and high cost of manual color adjustment. Therefore, the technical solution of the present invention solves the technical problems of existing technologies in supporting dynamic smooth transitions and adaptive detail processing between multiple regions, improving the partition compatibility of model color changing, the realism of gradient effects, and the efficiency of detail generation. Attached Figure Description
[0012] Figure 1 This is a flowchart of a method for changing the color of a virtual character model according to an embodiment of the present invention; Figure 2 This refers to a color-changing material according to an embodiment of the present invention. Algorithm flowchart; Figure 3 This is an example diagram showing a base color layer (left) and a detail layer (right) according to an embodiment of the present invention; Figure 4 This diagram illustrates an example of layer anchor point C: highlight detail and color space calibration according to an embodiment of the present invention. Figure 5 This image illustrates the effect of layer group x: shadow detail in an embodiment of the present invention. Figure 6 This diagram illustrates an example of the superimposed highlight details and outlining effect according to an embodiment of the present invention. Figure 7 This is an example diagram showing an overview of the color-changing detail SP layer according to an embodiment of the present invention; Figure 8 This is an example diagram showing a comparison of the color-changing effects of two differentiated virtual characters according to an embodiment of the present invention; Figure 9 This is a schematic diagram of the structure of a virtual character model color-changing system according to an embodiment of the present invention; Figure 10 This is a block diagram of a computer device for implementing embodiments of the present invention. Detailed Implementation
[0013] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0014] During the development of this invention, the inventors, through extensive experiments and data analysis, revealed the intrinsic relationship between the encoding characteristics of specific channel values in vertex color information and the color-changing partition identifier: by converting specific channel values of vertex color information into integer format and performing bitwise operations, multiple color-changing partition identifiers can be efficiently parsed, enabling compressed storage and rapid indexing of partition information. Based on this relationship, the inventors innovatively proposed this technical solution, utilizing the encoding processing mechanism of vertex color information to determine the color-changing partition identifier through bitwise operations, and combining multi-channel data control interpolation calculations of color-changing channel maps, thereby realizing multi-region dynamic smooth color changing of virtual character models, embodying the core concept of collaborative optimization of partition encoding and multi-level interpolation.
[0015] Specifically, through comparative experiments, the invention team discovered that traditional color-changing methods suffer from common problems: limited support for a limited number of regions and a lack of gradient effects. Traditional multi-channel map methods require multiple textures, increasing memory burden, while single-channel map thresholding methods cannot support smooth transitions between regions and are prone to color overflow. These technical deficiencies result in harsh color-changing effects, low resource efficiency, and insufficient visual fidelity. However, the multi-level interpolation calculation scheme based on vertex color encoding proposed in this invention can increase the number of supported color-changing regions to at least two and achieve seamless gradient transitions, resulting in highly efficient and high-fidelity dynamic color-changing effects.
[0016] Therefore, the present invention provides a method for recoloring a virtual character model according to the first aspect, which can be applied to a virtual character rendering system (hereinafter referred to as the "system"). This system can run on a graphics computing platform via a local application or cloud service to perform real-time dynamic model recoloring of virtual characters.
[0017] Specifically, this system can be deployed in various hardware environments, including but not limited to: local graphics workstations, mobile terminal devices, cloud gaming server clusters, and edge computing nodes. This flexible deployment architecture allows the system to meet both the low-latency requirements of high-performance graphics processing and the elastic allocation needs of different computing resources.
[0018] like Figure 1 As shown, the method may include: Step S110: Obtain the vertex color information, color-changing partition switch information, color-changing partition color array, diffuse texture, and color-changing channel texture of the virtual character.
[0019] Vertex color information refers to the color channel values used to store the color-changing partition encoding in the model vertex data; color-changing partition switch information refers to the integer variables that control the enabled state of each color-changing partition; color-changing partition color array refers to the data structure that stores the corresponding color values of each partition; diffuse map refers to the basic color texture map of the model; color-changing channel map refers to the multi-channel map that includes interpolation weights, blending weights, and brightness adjustment parameters.
[0020] Specifically, the system can be accessed through a graphical application programming interface (API) such as... or It reads vertex color information from the model resource file, obtains color swapping partition switch information and color array from the shader global variables, and loads diffuse map and color swapping channel map from the texture library. It refers to a cross-platform, open-standard graphics application programming interface, primarily used for rendering two-dimensional and three-dimensional vector graphics; It refers to a multimedia application programming interface suite developed by Microsoft, which includes the Direct3D component specifically designed for high-performance 3D graphics rendering on the Windows platform.
[0021] For example, when the system processes a character model with 16 color-changing zones, the G-channel value of the vertex color information is 0.5, the color-changing zone switch information is the binary number 0000000000001111 (indicating that the first 4 zones are enabled), the color-changing zone color array contains 16 HSV format color values (e.g., hue 0 degrees, saturation 100%, lightness 100% represents red), and the diffuse map is... The RGB texture, the color channel texture is RGB texture.
[0022] Step S120: Perform encoding processing on the vertex color information according to the specific channel values of the vertex color information to determine at least two color swapping partition identifiers. The encoding processing includes converting the channel values into integer format and determining the color swapping partition identifiers through bit operations.
[0023] Among them, the specific channel value refers to the G channel value used to encode partition information in the vertex color information; the encoding process refers to the operation process of converting the floating-point channel value into an integer and performing bitwise operations to extract the partition identifier.
[0024] Specifically, the system can use the vertex shader to convert the vertex color G channel values (range) Multiply by 255 and take the integer part to get an 8-bit integer. Then, separate the high 4 bits and low 4 bits by right shift (>>) and bitwise AND operation (&), which are used as the first color change zone identifier and the second color change zone identifier, respectively.
[0025] For example, when the system vertex color G channel value is 0.5, it is converted to the integer 128 (binary 10000000), with the high 4 bits being 1000 (decimal 8) and the low 4 bits being 0000 (decimal 0). Therefore, the first color change zone identifier is 8 and the second color change zone identifier is 0.
[0026] Step S130: Determine the color-changing enable status of each color-changing partition corresponding to the color-changing partition based on the switch status represented by the color-changing partition switch information. The color-changing enable status refers to the Boolean state configuration of whether the color-changing operation is enabled.
[0027] Among them, the switch status refers to the bit value (0 or 1) of the corresponding partition identifier in the color-changing partition switch information; the Boolean status configuration refers to the logical state of being enabled or disabled by using True or False.
[0028] Specifically, the system can use the left shift operation (<<) and the bitwise AND operation (&) in the pixel shader to check the bit value of the corresponding partition identifier in the color partition switch information. If the result is non-zero, the enabled state is true; otherwise, it is false.
[0029] For example, the color-changing zone switch information is 0000000000001111 (decimal 15), the zone identifier 8 corresponds to the 9th bit (starting from the 1st bit), the bit value is 1, so the enabled state is true; the zone identifier 0 corresponds to the 1st bit, the bit value is 1, and the enabled state is also true.
[0030] Step S140: Based on the color-changing enabled state, the original color of the diffuse map, and the channel data of the color-changing channel map, perform multi-level interpolation calculations on the color values in the color array of the color-changing partition to obtain the model rendering result.
[0031] Among them, multi-level interpolation calculation refers to the mathematical operation process of mixing color values step by step through weighting coefficients.
[0032] Specifically, the system can first select a color value based on the color swapping enable status using a pixel shader (if enabled, the color is taken from the color array; otherwise, the original color of the diffuse map is used), and then perform linear interpolation on the two partition colors using the R channel of the color swapping channel map as the weight. A mathematical operation method based on weight coefficients to perform linear transition calculations on two values to obtain intermediate results; then, the intermediate results are interpolated twice with the original color using the G channel as the weight, and finally the brightness is adjusted according to the B channel value (based on 0.5, greater than 0.5 brightens, less than 0.5 darkens).
[0033] For example, the partition color is red. The original color is blue. When the R channel weight is 0.5, the interpolation result is purple. When the G channel weight is 0.7, the result after mixing with the original color is... Brighten by 10% with a B channel value of 0.6, resulting in the following color: .
[0034] Step S150: Based on the model rendering results, perform rendering operations on the virtual character model through the fragment shader to complete the color change.
[0035] The rendering operation refers to the process of outputting the calculated pixel colors to the graphics display buffer.
[0036] Specifically, the system can use the model rendering result as the output color of the fragment shader through the graphics pipeline, configure the blending mode (such as Alpha blending, a pixel compositing technique based on the transparency channel, used to weight and blend the foreground color with the background color in graphics rendering to achieve visual effects such as semi-transparency and overlay) and depth test parameters, and call the drawing instructions to write the pixel data into the frame buffer.
[0037] For example, the fragment shader outputs a color of The model in The virtual character's appearance is rendered in a different color on the display device.
[0038] In another embodiment, such as Figure 2 The image shown is of a color-changing material. The algorithm flowchart illustrates the specific implementation process using the example of changing the color of the shoulder armor of a game character, "Armor Guardian." In this application scenario, the system needs to change the metal part of the shoulder armor (partition x1) from the default silver-gray to bronze, while the leather padding part (partition x2) retains its original brown effect. First, the system obtains the vertex color information of the "Armor Guardian" model, where the G-channel value of the vertices in the shoulder armor region is 0.625. The diffuse texture (resolution) is obtained through synchronous sampling via the graphics rendering pipeline. ), color channel texture (resolution) The system reads the color-changing partition switch information (binary value 00000011, indicating that only the first two partitions are enabled) and the color array of the color-changing partitions (containing 16 preset HSV color values). HSV (Hue, Saturation, Value) is a cylindrical coordinate color model based on human color perception, used to intuitively describe and manipulate color attributes. Next, encoding processing is performed in the vertex shader: the vertex color G channel value 0.625 is converted to integer format, the calculation process is as follows... After rounding, we get an 8-bit integer 159 (binary 10011111). Through bitwise operations, the first four bits 1001 (decimal 9) are determined as the first color-changing partition identifier x1, and the last four bits 1111 (decimal 15) are determined as the second color-changing partition identifier x2. Subsequently, in the fragment shader, the enabling status of each partition is determined based on the color-changing partition switch information: bitwise operations are performed on x1 (value 9)... The result of ) & 00000011 is 0, therefore the enabled status of partition x1 is false; execute ( ) on x2 (value 15) The result of &00000011 is non-zero, therefore partition x2 is enabled (true). Thus, partition x1 will use the original silver-gray sampled from the diffuse map. As the target color, partition x2 will index color number 15 from the color array—the target brown. The target color is used. Then, multi-level interpolation calculations are performed: the R channel value of the color-changing channel map is 0.0, indicating that the first-level interpolation uses the color of partition x1 completely, so the intermediate result c4 is silver-gray. A G channel value of 0.8 indicates that the color replacement result accounts for 80% and the original color accounts for 20% in the second-level interpolation. The intermediate result c4 is mixed with the target brown color of partition x2, and the calculated base color replacement color c5 is... The B channel value is 0.4, which is lower than the baseline value of 0.5, so a darkening adjustment is performed, with an adjustment factor of [value missing]. The final model rendering result is Finally, based on the rendering results, the system configures the fragment shader's blending mode parameters (set to regular alpha blending), color writing parameters (enable all RGB channels), and depth test parameters (set to less than or equal to). Pixel color data is written to the frame buffer via drawing commands, resulting in a real-time color-changing effect in the game screen where only the leather padding of the shoulder armor changes to brown, while the metal parts retain their original texture. This embodiment fully demonstrates the end-to-end technology implementation from data encoding and state judgment to interpolation rendering.
[0039] Therefore, according to the above implementation method, the system acquires the vertex color information, color-changing partition switch information, color-changing partition color array, diffuse map, and color-changing channel map of the virtual character to collect the basic data resources required for model rendering; it performs encoding processing on the vertex color information according to the specific channel values of the vertex color information to determine at least two color-changing partition identifiers. The encoding processing includes converting the channel values into integer format and determining the color-changing partition identifiers through bitwise operations (binary operations) to achieve compressed storage and efficient parsing of partition information; it determines the color-changing enable state of the color-changing partition corresponding to each color-changing partition identifier according to the switch state represented by the color-changing partition switch information. The color-changing enable state refers to the Boolean state (binary logic state) configuration of whether the color-changing operation is enabled, which is used to dynamically control the enabling conditions of the color-changing operation of each partition; based on the color-changing enable state, the original color of the diffuse map, and the channel data of the color-changing channel map, it performs multi-level interpolation calculations on the color values in the color array of the color-changing partition to obtain the model rendering result, which is used to generate intermediate rendering data that blends the original details and the color-changing effect; according to the model rendering result, it uses a fragment shader ( This function performs rendering operations on the virtual character model to complete the color change, and is used to achieve the graphical output of the final color change effect.
[0040] Specifically, in this embodiment, addressing the issue of insufficient multi-region support mentioned in the background technology, at least two color-changing partition identifiers are determined through encoding processing based on vertex color information. This achieves bitwise compressed storage of partition information, resolving the memory burden increase caused by the increase in the number of regions in traditional multi-channel map methods. Regarding the issues of missing gradient effects and color overflow, multi-level interpolation calculations are driven by channel data from the color-changing channel map, achieving smooth color transitions between partitions and edge overflow control. Addressing the issue of low efficiency in detail processing, the stability of color-changing details is achieved through the Boolean configuration of the color-changing enabled state and the collaborative processing of the original color of the diffuse map, avoiding the subjectivity and high cost of manual color adjustment. Therefore, the technical solution of this embodiment solves the technical problem that existing technologies struggle to support dynamic smooth transitions and adaptive detail processing between multiple regions, improving the partition compatibility of model color changing, the realism of gradient effects, and the efficiency of detail generation.
[0041] In another embodiment, such as Figure 3 The image shows an example of a base color layer (left) and a detail layer (right), illustrating the automated process of generating channel data for each channel in a color-changing channel texture by separating layers. This example uses the color-changing of the "DP-12" rifle skin in a third-person shooter game as an example, aiming to change its primary color from yellow to dark blue (referring to the target color-changing effect, in...). Figure 3 (Not yet displayed in the image), while retaining the wear marks, markings, and highlight details of the firearm.
[0042] In practice, the system first imports the original diffuse map of the "tactical rifle" into image processing software (such as Substance 3D Painter, an industry-standard 3D texture painting and material creation software developed by Adobe, specifically designed to provide intelligent texture mapping generation and editing tools based on physically based rendering workflows for game, film, and digital media creation). As shown in the example image on the left, the base color layer contains the basic color distribution of the firearm, namely a large area of yellow. With structural black Area. As shown on the right of the example image, the detail layer is based on the base color and extracts high-frequency information through image processing algorithms (such as high-contrast preservation). It includes wear and scratches on the gun body (light-colored lines with high brightness), manufacturer markings (high-contrast logo), and shadows at the seams of parts (dark areas with low brightness).
[0043] Next, the system performs layer operations to generate a color channel texture: Step 301: Generate the first channel data (interpolation weight coefficients); the system creates a new layer and fills it based on the color saturation information of the base layer. For example, the system completes this in image processing software through an automated script or manual operation, filling the high-saturation yellow main area with a value of 0.8 and the low-saturation black part area with a value of 0.2. This grayscale image serves as the R channel data controlling the transition weights of the primary and secondary color transition zones. Step 302: Generate second channel data (blending weight coefficients); the system references the anchor points of the detail layer and performs a "difference" blending mode operation on the base color layer to extract edge details with drastic color changes. Subsequently, the brightness information of this operation result is normalized and used as G channel data to control the degree of blending between the color replacement result and the original details. For example, the blending weight coefficient at the edge of the gun marking is 0.9, while the coefficient for flat color block areas is 0.1. Step 303: Generate third channel data (brightness and darkness adjustment parameters); The system again references the base color layer anchor point and performs a "subtract" blending mode operation on the detail layer to separate highlight details (such as worn highlights) from shadow details (such as recessed shadows). Subsequently, the highlight areas are mapped to values greater than 0.5 (such as 0.7), and the shadow areas are mapped to values less than 0.5 (such as 0.3), generating B channel data for dynamically adjusting brightness and darkness.
[0044] Finally, the system merges the three single-channel image data generated by the above operations and outputs a complete RGB format color-changing channel texture. In subsequent color-changing rendering, when the user sets the target color to dark blue... The system will smoothly blend the colors of the weapon's body and components based on the R channel data of the texture, preserve markings and wear details based on the G channel data, and enhance the contrast of highlights and shadows based on the B channel data. This achieves a color change effect that accurately changes the main color tone while completely preserving the texture details of the original model. This embodiment automatically generates channel data through layer operations, replacing traditional manual drawing and color adjustment, thus improving the realism of the color change effect and production efficiency.
[0045] In some embodiments, the vertex color information is encoded based on specific channel values to determine at least two color-swap partition identifiers, including: Convert specific channel values in vertex color information into encoded values in integer format.
[0046] The integer format encoded value refers to the integer value obtained by linearly mapping and rounding the specific channel value represented by the floating-point number.
[0047] Specifically, the system can convert values within a range of 100 by performing multiplication and type conversion operations in the shader program. Floating-point channel values mapped to The integer range. For example, for a specific channel value (i.e., the vertex color G channel value) of 0.75, the system performs the following calculation: The result was 191.
[0048] Bitwise operations are performed on the encoded value in integer format to separate the high-order and low-order parts from the encoded value.
[0049] The high-order part refers to the combination of bits in the high-order bits of the binary representation of the encoded value, while the low-order part refers to the combination of bits in the low-order bits of the binary representation of the encoded value.
[0050] Specifically, the system can shift the encoded value 4 bits to the right using a right shift operation (>>), then perform a bitwise AND operation (&) with the original encoded value to combine it with the mask (0x0F, i.e., binary 00001111), extracting the high 4 bits and low 4 bits respectively. For example, for the encoded value 191 (binary 10111111), the system performs the following operation: This gives us binary 1011 (decimal 11). This gives us the binary number 1111 (decimal number 15).
[0051] The high-order part is determined as the first color-changing partition identifier, and the low-order part is determined as the second color-changing partition identifier. The first color-changing partition identifier and the second color-changing partition identifier are used as indices of the corresponding color values in the color-changing partition color array.
[0052] An index is a location identifier used to locate and access a specific element in an array.
[0053] Specifically, the system can directly use the integer values of the first and second color-changing partition identifiers as indices to access the color value stored at the corresponding position in the color array of the color-changing partition. For example, if the color array of the color-changing partition contains 16 preset colors, the first color-changing partition identifier 11 will point to the 12th color in the array (such as cyan), and the second color-changing partition identifier 15 will point to the 16th color in the array (such as white).
[0054] Therefore, according to the above implementation method, the system can efficiently decode the single-precision floating-point value in the vertex color information into two independent color-changing partition identifiers, providing accurate input parameters for subsequent partition-based color interpolation and mixing calculations.
[0055] In some embodiments, determining the color-changing enable status of each color-changing zone corresponding to its identifier based on the switch status represented by the color-changing zone switch information includes: Based on the numerical values of each color-changing zone identifier, bitwise operations are performed on the color-changing zone switch information to generate the mask value corresponding to each color-changing zone.
[0056] The mask value is an integer value extracted from the color-changing zone switch information through bitwise operations (binary operations) to represent the state of a specific zone switch.
[0057] Specifically, the system can use the fragment shader program to generate a bitmask corresponding to the partition identifier using a left shift operation (<<), and then perform a bitwise AND operation (&) with the color-change partition switch information to isolate the switch status bits of the target partition. For example, if the color-change partition identifier is 5 (decimal) and the color-change partition switch information is the binary number 0000000000100000 (decimal 32), the system performs the operation: Mask value = Color-change partition switch information & ( ), which gives binary 0000000000100000 (decimal 32), a non-zero value indicates that the partition is enabled.
[0058] If any mask value is equal to the preset valid state threshold, then the color-changing enable state of the corresponding color-changing partition is determined to be enabled.
[0059] The effective state threshold is a reference value used to determine whether the mask value represents an enabled state, and it is usually set to a non-zero value (such as 1).
[0060] Specifically, the system can check whether the mask value is equal to the valid state threshold using a comparison instruction (such as an equality comparison). If the condition is met, the color-changing enable status of the corresponding color-changing partition is marked as True. For example, if the mask value is 32 (non-zero) and the valid state threshold is 1, then... If the mask value is 1, the activation condition is not met; however, if the mask value is 1, it is equal to the threshold, and the system determines that the color-changing activation status of the partition is enabled.
[0061] If any mask value is not equal to the valid state threshold, then the color-changing enable state of the corresponding color-changing partition is determined to be disabled.
[0062] The "off state" refers to the logical state in which the color-changing operation is not activated.
[0063] Specifically, the system sets the color-changing enable state to False when the mask value is not equal to the valid state threshold (including zero or other non-matching values). For example, when the mask value is 0, The system determines that the color-changing enable status is off; when the mask value is 16, It is also determined to be in a closed state.
[0064] Therefore, according to the above implementation method, the system can efficiently and accurately determine the activation status of each color-changing partition through bit operations and threshold comparison, providing a dynamic control basis for subsequent multi-partition color-changing operations.
[0065] In some embodiments, the step of obtaining the color-changing channel texture includes: The first, second, and third channel data are sampled through the graphics rendering pipeline to generate color-changing channel maps through image processing operations.
[0066] Among them, graphics rendering pipeline sampling refers to sampling through graphics application programming interfaces (such as graphics rendering pipeline sampling). or The rendering pipeline of a rendering process extracts data from texture maps; image processing operations refer to the technical process of generating target texture maps in professional image processing software (such as Substance 3D Painter) through layer blending, anchor point referencing, and color space conversion. Specifically, the system can access texture resources through vertex shaders or fragment shaders, and sample the original data of diffuse maps and color-shifting channel maps. Then, in the image processing software, layer groups are created, and grayscale data corresponding to the three channels are generated by referencing anchor points, setting blending modes (such as subtraction mode or difference mode), and adjusting color level parameters. Finally, a color-shifting channel map containing multi-channel information is synthesized.
[0067] For example, when processing a recolored detail image of a character model, the system first obtains the base texture data (resolution) through the rendering pipeline sampling. Then, in Substance 3D Painter, a layer group is created, anchor point A (base layer) and anchor point B (detail layer) are set, the highlight details are calculated using subtractive blending mode, and the shadow details are calculated using interpolation blending mode. Finally, a three-channel color-changing texture file is output (PNG format, 512 kilobytes in size).
[0068] The first channel data provides the interpolation weight coefficients between the two color-changing zones, the second channel data provides the weight coefficients for mixing the color-changing result with the original color, and the third channel data provides the brightness adjustment parameters.
[0069] Specifically, the interpolation weight coefficients stored in the first channel data (R channel) are used to control the linear transition ratio between the colors of the two color-changing zones; the mixing weight coefficients stored in the second channel data (G channel) are used to adjust the degree of fusion between the color-changing result and the original diffuse color; and the brightness adjustment parameters stored in the third channel data (B channel) are used to increase or decrease the brightness of the color-changing area according to a threshold (such as 0.5).
[0070] For example, when the first channel data value is 0.3, it means that the color weight of partition one accounts for 30%, and the color weight of partition two accounts for 70%; when the second channel data value is 0.8, it means that the color replacement result accounts for 80%, and the original color accounts for 20%; when the third channel data value is 0.6, it means that the brightness is increased by 20% on the basis of the base brightness. The calculation method is as follows: .
[0071] Therefore, according to the above implementation method, the system can automatically generate channel textures that adapt to the color changing needs of multiple zones through a standardized process, avoiding subjective errors in manual drawing and improving the efficiency and consistency of texture production.
[0072] In another embodiment, such as Figure 4 The image shown is an example of layer anchor point C: highlight detail and color space calibration. It demonstrates how, in the color-changing channel texture generation process, the system references the anchor point of the detail layer and calls color space calibration parameters in 3D rendering or image processing software to standardize and optimize the extraction of highlight detail information. This example uses a model of the "DP-12" rifle from a third-person shooter game. The right panel of the attached image shows the parameter configurations for the detail layer. For example, by adjusting attributes such as "detail transparency (grayscale)" and combining it with "input Gamma" correction, the aim is to ensure that the highlight and luminescence information extracted from the original model maintains consistent contrast and depth under different lighting and color spaces, laying the foundation for the subsequent generation of high-quality blending weight coefficients (G channel data). This calibration step is crucial for maintaining the texture of highlight areas such as the energy core and metallic highlights after color changing.
[0073] like Figure 4 As shown in the software interface on the right, layer anchor point C is created and can be used to associate specific layers, such as highlight details, to achieve parametric management and calibration. The specific operation process can be based on this anchor point configuration, and its core logic and steps are as follows: Step 401: Detail Layer Association and Preliminary Processing; The system can separate detailed areas requiring fine control (such as highlights or glowing parts of the model) from the original texture and associate them with specific layer anchor points (such as anchor point C). Figure 4 As shown, through the list of anchor points in the interface (such as " This allows for the management of these relationships. This step lays the foundation for subsequent targeted calibration.
[0074] Step 402: Color Space Calibration Configuration; Due to potential differences in color spaces between different software and rendering environments, directly using extracted details may lead to distortion in the final result. Therefore, the system provides, for example... Figure 4 The calibration functions shown on the right side of the interface include, for example, the "Input Gamma" adjustment. By adjusting such parameters (the example value in the image is 0.3), a non-linear transformation can be performed on the layer data associated with anchor point C to correct it in different color spaces (such as...). To ensure consistent data performance across different processes, we must address potential brightness and contrast deviations that may occur during conversion between linear and nonlinear spaces.
[0075] Step 403: Generate standardized channel data; After calibration, the system can standardize and map the calibrated layer grayscale information to generate channel data (e.g., as one of the sources of the B channel in the color-changing channel map) for controlling color-changing effects (such as brightness adjustment). This mapping rule can be defined according to the target effect, for example, mapping bright areas to higher weight values and dark areas to lower weight values, thereby intelligently preserving the original light and shadow levels and texture distribution during color changing.
[0076] This process enables the system to manage and calibrate key detail data through anchoring and parameterization, ensuring the accuracy of visual information transmission from material processing to final rendering. This embodiment highlights the technical advantages of achieving precise control of detailed data across processes through anchor configuration and parameter calibration interfaces, which is a crucial step in improving the fidelity of color-changing effects and the reliability of the workflow.
[0077] In another embodiment, such as Figure 5 The image shown is an example of the effect of layer group x: shadow detail. It demonstrates how to accurately separate and enhance shadow detail information from a complex model structure through multiple masks and blending mode configurations, ensuring that the model's three-dimensionality and texture are fully preserved after color recoloring. This example uses the color recoloring of a sci-fi sniper rifle skin codenamed "DP-12" in a third-person shooter game as an example, aiming to change the main color of the gun body from the default gray-white. Change to tactical dark gray At the same time, it is necessary to precisely maintain the visual depth of all grooves, heat dissipation holes, markings, and dark areas such as weathering and wear on the gun body.
[0078] like Figure 5 As shown in the hierarchy list on the right, layer group x is specifically configured to handle shadow details, and its structure includes: Step 501: Masking Group 1 (Mask); This layer is generated based on the weapon model's normal map and ambient occlusion map, used to define physically dark areas (such as structural grooves and gaps). Figure 5 As shown in the weapon rendering on the left, these areas appear as dark gray shadows on a gray-white background; Step 502: Layer 1 (Multiply); This layer is associated with Mask Group 1 and uses the "Multiply" blending mode to simulate shadow overlay effects, further enhancing the depth and texture of dark areas; Step 503: Color Adjustment Layer; This layer adjusts the color levels and curves of the above mixing results to ensure that the extracted dark information is within a reasonable range of linear space in terms of brightness (e.g., mapping the darkest part to 0.1 and the midtones to 0.3), so as to avoid loss of details during subsequent color replacement. In practice, the system executes the following process: Dark detail extraction: The system activates layer group x in the image processing software, limits the processing area through mask group 1, and then performs a "Multiply" blending operation on layer 1 to generate a grayscale image that only contains dark details. For example, the recessed area of the "M-12" marking on the gun body has a corresponding value of 0.15 in this grayscale image, while the corresponding value of the deep heat sink can reach 0.05.
[0079] Generate channel data: This grayscale image, after color space calibration (conversion to linear space) and numerical remapping, serves as an important component of the third channel data of the color replacement channel map. The system overlays and blends it with the highlight detail data to finally synthesize the complete B channel data.
[0080] Color-changing effect implementation: When applying a dark gray target color, this B-channel data ensures that all dark areas such as grooves and engravings on the original gray-white model retain accurate light and shadow variations based on their original depth after color changing. For example, deep heat sinks still appear near black on a dark gray background. Superficial scratches appear as a medium dark gray. .
[0081] This example demonstrates that using a proprietary dark detail layer group for structured extraction and calibration can effectively solve the common industry problem of "flattening" model surface details during color changes. It ensures that the visual depth information of both structural shadows and surface wear can be adaptively preserved after color changes, thus improving the realism of color changes for models with high detail complexity.
[0082] In other embodiments, such as Figure 6 The image shown is an example of overlaying highlight details and outlining effects, illustrating how layer overlay and linear structure enhancement techniques can significantly improve the material expressiveness and outline clarity of complex mechanical models when generating color channel maps. This example uses the skin recoloring of the prototype energy rifle "Pulse Ripper" from a science fiction game as an example, aiming to change the main color of the gun body from the default cold iron gray. Change to fiery orange It must also highlight the sharp mechanical edges and luminous texture of the energy conduits in its futuristic design.
[0083] like Figure 6As shown, the main body of the firearm is clearly outlined by a finely detailed "line drawing" layer, outlining all the robust mechanical seams, heat sinks, and energy pipes. This line drawing layer is generated through the following process: the system can generate a normal map (a technique used in 3D computer graphics to simulate complex surface details) based on high-poly model baking, or use alternative methods (such as manual drawing or third-party plugins) to extract details; subsequently, all areas with high curvature variations are extracted using a "find edges" image filter or similar tool, followed by thresholding and line refinement (which can be automated or manually adjusted), ultimately generating a pure white line drawing image with a single pixel width. In subsequent compositing, the brightness information of this layer (usually mapped to a high value close to 1.0) will be an important component of the second channel data (blending weight coefficient), ensuring that these key linear structures can preferentially retain their high-contrast outline effect during color replacement, avoiding blurring due to color mixing.
[0084] at the same time, Figure 6 The composite effect of the highlight detail layer was demonstrated through the "Overlay (Brightness Cap)" operation. Specifically, the system merges the bright details of the energy core (data associated with layer anchor point C) extracted and calibrated in the previous embodiment with other highlight areas of the gun body (such as the edge of the scope and the trigger guard) identified through metallic mapping. The "Linear Dodge (Add)" blending mode was used during the merging process, and the brightness cap was set to 0.9 to prevent overexposure. The grayscale information of this merged highlight detail layer (e.g., 0.85 for the energy conduit's glowing area and 0.7 for the sharp metallic highlights) will serve as the key input for the third channel data (brightness adjustment parameters).
[0085] In practical color-changing applications, when the target fiery orange is applied, the technical solution of this embodiment will produce the following effects: Step 601: Outline effect ensures the outline; the black outlines of all mechanical structures remain clear and sharp on the orange background, and the rugged and technological shape of the firearm is preserved without damage.
[0086] Step 602: Overlay highlights to enhance texture; the energy conduit area will appear as a bright, self-illuminating orange. The metallic highlight areas appear as a smooth, bright orange. The differences in materials on the gun body surface (light-emitting elements and polished metal) are accurately distinguished and reproduced.
[0087] This embodiment demonstrates that by specially generating and overlaying outlining and highlighting detail layers, and encoding their information into the corresponding channels of the color-changing channel map, it is possible to solve the industry pain point of softened outlines and loss of material properties in complex mechanical models after color changes, ensuring that the core shape recognition and material realism are enhanced rather than weakened after color changes.
[0088] In other embodiments, such asFigure 7 The image shown is an example of an overview of the SP layer for color-changing details. It demonstrates how, in professional image processing software (such as Substance 3D Painter), a reusable, non-destructive editing workflow can be built using a sophisticated layer structure and anchor point referencing mechanism to achieve efficient and stable color-changing detail generation. This example uses the color-changing of a composite material cloak for the "Ranger" class in a role-playing game. This cloak combines fabric, leather, and metal trim, and the goal is to change the overall color of the cloak from dark green... Change to dark red And ensure that the texture details of each of the three materials (such as the weave of the fabric, the wrinkles of the leather, and the scratches of the metal) remain clearly distinguishable under the new color.
[0089] like Figure 7 As shown, the layer overview clearly divides the functional modules, and its core logic flow and layer functions are as follows: The base color and detail separation module (Module A) is located at the bottom of the Layers panel and is responsible for establishing the baseline for color calculations. Layer a (referencing anchor point A: thin tube) and layer b (referencing anchor point B: base color) respectively reference the anchor points for the "thin tube" (detail) and "base color" areas defined in the diffuse map. By setting these two layers to the "Diff" blending mode, the system calculates the precise color offset of the detail layer relative to the base color, providing clean material for subsequent light and dark separation. The highlight detail extraction and compositing module (Module B) is responsible for generating grayscale information for brightening areas. The subtractive highlight (highlight) anchor point defines the highlight areas on the cape that need to be emphasized, such as the raised parts of the leather folds and the lit surfaces of the metal trim. Layers f and h both reference the above anchor point C and use "linear addition" ( The linear dodge blending mode effectively simulates the effect of light overlay, brightening the area defined by anchor point C and generating a mid-grayscale image representing the details of the highlights. The system may use multiple similar layers to finely control the intensity of highlights; Shadow detail building module (module C); This module is responsible for generating grayscale information to deepen shadow areas; Layer x: Shadow; This layer is usually based on an ambient occlusion map or a mask generated by other algorithms, used to identify shadow areas such as fabric seam recesses and deep leather folds. Its "Norm" blending mode ensures the direct application of shadow information; Global integration and calibration module (module D); This module integrates and standardizes the details extracted above; Detail map (color map B); This is the main layer of the final output detail map, which integrates the color levels from the highlight and shadow modules. Adjustment layer: This is a crucial post-processing step. For example... Figure 7As shown, this adjustment layer is applied multiple times to adjust the color levels of the intermediate grayscale image in the composite, ensuring that its brightness values are accurately mapped to a preset value suitable for subsequent color replacement. Within the algorithm's range (e.g., normalizing all values to between 0.2 and 0.8), the stability and consistency of light and dark contrast are guaranteed after color change; the outline layer; located at the top, is used to enhance linear details such as stitching and pattern edges on the cape, ensuring that its outline is not weakened after color change.
[0090] In practice, artists or automated scripts first establish "anchor point A" (base color), "anchor point B" (details), and "anchor point C" (highlights), and the system then... Figure 7 The templated layer structure shown automatically generates various functional layers. Through this structured, data-driven workflow, simply replacing the selection area associated with "anchor point C" or adjusting the "levels" parameter allows for the rapid generation of high-quality color-changing detail images (i.e., the data source for color-changing channel textures) for different model components. This significantly reduces repetitive manual drawing and debugging, ensuring a high degree of controllability and artistic quality of the color-changing effect in mass production. This embodiment profoundly reveals the core advantage of this invention: transforming subjective artistic processing into a configurable and reusable standardized production process through software-engineered layer management.
[0091] In another embodiment, such as Figure 8 This image shows a comparison of the color-changing effects of two differentiated virtual characters achieved using the color-changing method of this invention. The virtual character on the left (for example, it could be named "Crimson Winged Warrior") uses red and white as the main color scheme and has red-orange gradient hair, with a first type of wing-shaped mark on the top of its head; the virtual character on the right (for example, it could be named "Azure Winged Dharma Master") uses blue and white as the main color scheme and has golden hair, with a second type of wing-shaped mark on the top of its head that is structurally similar to the left character but has a different color scheme.
[0092] In this embodiment, the system first acquires the vertex color information, color-changing partition switch information, color-changing partition color array, diffuse texture, and color-changing channel texture of the two virtual characters. Specific channel values of the vertex color information (such as the G channel) are used for encoding: the system converts the floating-point channel value to integer format and separates the high and low bits through bitwise operations, determining them as the first color-changing partition identifier (e.g., partition 0) corresponding to the main body area of the left virtual character and the second color-changing partition identifier (e.g., partition 1) corresponding to the main body area of the right virtual character. Based on the color-changing partition switch information (e.g., the 16-bit integer 0x0003), the system generates the partition mask value through bitwise operations, determining that both partition identifiers are in an enabled state. Subsequently, based on the enabled state, the system retrieves preset color values from the color array of the color-changing partitions (e.g., the target color for the left character is RGB180,40,60 for red, and the target color for the right character is RGB50,100,200 for blue), and performs multi-level interpolation calculations in conjunction with the channel data of the color-changing channel map: first, the first channel data (R channel) is used as the partition color interpolation weight to obtain the intermediate color-changing result; then, the second channel data (G channel) is used as the blending weight to fuse the intermediate result with the original color of the diffuse map to generate the basic color-changing color; finally, the brightness and darkness are adjusted according to the third channel data (B channel), and the model rendering result is output. By configuring rendering state parameters (such as blending mode and color write mask) through the fragment shader, the system writes pixel color data to the frame buffer to complete the color-changing operation.
[0093] like Figure 8 As shown, after the color change, the left virtual character "Red Wing War Spirit" presents a red and black main color scheme, while the right virtual character "Azure Wing Dharma Lord" presents a blue and white main color scheme. Furthermore, the texture details of the characters, the gloss levels of the wing-shaped logo, and the folds of the clothing are all adaptively preserved through multi-level interpolation, which verifies the technical advantages of this solution in supporting dynamic color changes of multiple virtual characters while taking into account partition compatibility, gradient smoothness, and detail fidelity.
[0094] In some embodiments, based on the color-swapping enabled state, the original color of the diffuse map, and the channel data of the color-swapping channel map, multi-level interpolation calculations are performed on the color values in the color-swapping partition color array to obtain the model rendering result, including: Based on the color-changing enable status of each color-changing partition, the color value of the corresponding enabled color-changing partition identifier is obtained from the color array of the color-changing partition as the target color value. For partitions where color-changing is not enabled, the original color of the diffuse map is used as the target color value.
[0095] The target color value refers to the input color data that is dynamically selected based on the color change activation status and used for subsequent interpolation calculations.
[0096] Specifically, the system checks the enable status (Boolean value) of each color-changing partition through the pixel shader program. If enabled, it indexes the color value of the corresponding partition identifier from the color array of the color-changing partition; if disabled, it directly uses the original color value sampled from the diffuse map. For example, for two color-changing partitions, if partition one is enabled (color-changing enable status is true), its color value is red. If partition two is not enabled (color change enabled status is false), then the original blue color of the diffuse texture will be used. At this point, the target color values are red and blue, respectively.
[0097] Based on the data from the first channel, perform first-level interpolation calculations on at least two target color values to obtain intermediate color-changing results.
[0098] The intermediate color change result refers to the transition color value obtained through the first-level interpolation calculation, which is used to connect the color mixing of the two partitions.
[0099] Specifically, the system uses the first channel data (R channel) of the color-changing channel texture as the interpolation weight coefficient, and uses a linear interpolation function ( This involves performing a blending calculation on the two target color values. For example, if the first channel data value is 0.3 (i.e., 30% weight), and the target color is red. The target color is blue. ,but: ; Calculation method: Red component The blue component is similar.
[0100] The base color is obtained by performing a second-level interpolation calculation on the intermediate color-changing result and the original color of the diffuse texture based on the second channel data.
[0101] Among them, the base color refers to the baseline color value obtained after two-level interpolation, which combines the color-changing effect with the original details.
[0102] Specifically, the system uses the second channel data (G channel) of the color-changing channel map as the blending weight coefficient, and performs linear interpolation calculation between the intermediate color-changing result and the original color of the diffuse map. For example, if the second channel data value is 0.6 (i.e., 60% weight), the intermediate color-changing result is... The original color is green. ,but (Calculation method: red component) (The other components are similar).
[0103] The brightness and darkness of the base color are adjusted based on the data from the third channel to obtain the model rendering result.
[0104] The model rendering result refers to the color value that can be used for rendering output after the final brightness and shading optimization.
[0105] Specifically, the system uses 0.5 as the base brightness and adjusts the brightness based on the third channel data (B channel) value of the color-changing channel map: if the B channel value is greater than 0.5, it brightens proportionally; if it is less than 0.5, it darkens proportionally. For example, if the third channel data value is 0.6 and the base color-changing color is... , (i.e., brighten by 20%), then (Result after rounding each component).
[0106] Therefore, according to the above implementation method, the system can dynamically fuse the colors of the color-changing partitions with the original details through multi-level interpolation calculation, and automatically optimize the brightness and darkness performance, and finally generate a high-fidelity model rendering result.
[0107] In some embodiments, the fragment shader is configured with vertex attribute input parameters, material map sampling parameters, and color calculation parameters; according to the model rendering results, the fragment shader performs rendering operations on the virtual character model to complete the color change, including: Configure rendering state parameters for the fragment shader based on the model rendering results and the material properties of the virtual character.
[0108] Among them, rendering state parameters refer to the set of configurations that control pixel processing behavior in the graphics rendering pipeline, including blending mode, color write mask, depth test rules, etc.
[0109] Specifically, the system uses a graphical application programming interface (API) such as or The system dynamically sets the alpha blending mode based on the transparency characteristics of the model rendering results, configures the face culling rules according to the double-sided rendering requirements in the material properties, and adjusts the depth test function for the material type of the virtual character. For example, for a semi-transparent material character, the system sets the blending mode to source color multiplied by source alpha value plus target color multiplied by 1 minus source alpha value. , a standard equation used in computer graphics to define pixel blending operations), color write mask with all four channels of RGBA (red, green, blue, and transparency) fully open, and depth test function is less than or equal to (LessThan or Equal, a comparison function used in the graphics rendering pipeline for depth testing or stencil testing, abbreviated as LEQUAL).
[0110] The graphics application programming interface (API) submits drawing commands to the graphics processor, triggering the fragment shader to perform rendering calculations based on vertex attribute input parameters, material map sampling parameters, and color calculation parameters, according to the model rendering results, and generate pixel color data.
[0111] Among them, drawing commands refer to geometric primitive rendering commands initiated through the graphics API (Application Programming Interface); pixel color data refers to a two-dimensional array containing color information generated after calculation by the fragment shader.
[0112] Specifically, the system uses a graphics API (such as...) or The system submits a drawing command for a triangle primitive in the instruction buffer. The fragment shader obtains the interpolated texture coordinates based on the vertex attribute input parameters, performs bilinear filtering sampling on the diffuse map using material map sampling parameters, and performs color blending operations based on the lighting coefficients in the color calculation parameters. For example, if the system submits a model drawing command containing 16384 triangles, the fragment shader will perform the drawing command based on the texture coordinates (UV values). The base color is obtained by sampling the diffuse map. Combined with model rendering results Perform a multiply blending mode to ultimately generate pixel color data. . Metal is an open, cross-platform explicit graphics and computing API designed to minimize driver layer overhead, giving developers fine-grained control over GPU resources. Metal is specifically designed for the Apple ecosystem (iOS, iOS, etc.). , Optimized, low-overhead graphics and computing APIs, deeply integrated with the features of Apple hardware and operating systems.
[0113] Pixel color data is input into the frame buffer managed by the graphics system to complete the color swap.
[0114] The frame buffer is a video memory area used to store the final rendered output image, and it typically includes a color buffer, a depth buffer, and a stencil buffer.
[0115] Specifically, the system uses the framebuffer object management interface of the graphics driver to write the pixel color data output by the fragment shader into the color appendix of the currently active framebuffer according to screen coordinates, and synchronously updates the depth buffer information for subsequent depth testing. For example, in At the specified display resolution, the system will use pixel coordinates Color value at The data is written to the position of row 768, column 1024 of the frame buffer, and the complete frame data is transmitted to the display device via the vertical synchronization signal.
[0116] Therefore, according to the above implementation method, the system can achieve the final visual output of the color-changing result through a standardized rendering pipeline, ensuring the correct presentation and display synchronization of the color-changing effect of the virtual character model.
[0117] In some embodiments, rendering state parameters are configured for the fragment shader based on the model rendering results and the material properties of the virtual character, including: The blending mode parameters are determined based on the material properties of the virtual character. These parameters are used to control the blending of the model rendering result with the background color.
[0118] The blending mode parameter is a set of mathematical rules that specify the blending operation between the fragment shader output color and the existing color in the frame buffer.
[0119] Specifically, the system uses a graphical application programming interface (API) such as or The state management function selects the corresponding blending function equation based on the transparency type (such as opaque, semi-transparent, or brightening effect) in the material properties. For example, for a semi-transparent material character, the system sets the blending mode to source color multiplied by source alpha value plus target color multiplied by one minus source alpha value. When the Alpha value of the model rendering result is 0.8, the new pixel color is mixed with the background color in a ratio of 8:2.
[0120] The color writing parameters are determined based on the transparency characteristics of the model rendering results. These parameters control the channel permissions for writing color data to the frame buffer.
[0121] Among them, the color write parameter refers to the Boolean mask that controls whether the four color channels, red (R), green (G), blue (B), and transparency (A), are allowed to be written to the frame buffer.
[0122] Specifically, the system uses bitmask setting functions (such as...) A kind of This is a state setting function in the graphics application programming interface (API) used to control the permissions for writing color data to the frame buffer. It dynamically enables or disables the write permissions for specific color channels based on the alpha channel value of the model rendering result to prevent transparent areas from accidentally covering background content. For example, when the alpha value of the model rendering result is below the threshold of 0.1, the system sets the color write parameter to disable the alpha channel (mask value RGB_true_A_false), allowing only RGB color data to be written to the frame buffer.
[0123] Based on the rendering requirements of the virtual character model, set the depth test parameters and template test parameters. The depth test parameters are used to control the pixel depth comparison operation, and the template test parameters are used to control the pixel template buffer operation.
[0124] Among them, the depth test parameters are the rule set that specifies the depth comparison function (such as less than or equal to), and the template test parameters are configuration items that control the template value comparison and update operations.
[0125] Specifically, the system uses the depth testing function of the graphics API (such as...) It is a kind of The graphical application programming interface (API) is used to set the status commands of the depth test comparison function and template test functions (such as...). It is a kind of In the graphics application programming interface (API), state commands are used to set the template test comparison function and reference value. Test conditions and operations are set according to rendering requirements (such as character occlusion relationships and special effects area masking). For example, for characters that require foreground priority display, the depth test parameter is set to the less than or equal to (LEQUAL) function, and the template test parameter is set to pass the test when the template value is equal to 1 and then increment the template value. ).
[0126] Therefore, according to the above implementation method, the system can accurately control the pixel compositing behavior by dynamically configuring rendering state parameters, ensuring the correct integration and depth hierarchy between the recolored virtual character and the scene background.
[0127] Figure 9 This is a structural block diagram of a virtual character model color-changing system according to an embodiment of the present invention.
[0128] like Figure 9 As shown, the virtual character's model color-changing system includes: The virtual character information acquisition module 210 is used to acquire the vertex color information, color-changing partition switch information, color-changing partition color array, diffuse map, and color-changing channel map of the virtual character. The color-changing partition identifier marking module 220 is used to perform encoding processing on the vertex color information based on specific channel values to determine at least two color-changing partition identifiers. The encoding processing includes converting channel values to integer format and determining the color-changing partition identifiers through bitwise operations. The color-changing activation status recognition module 230 is used to determine the color-changing activation status of the corresponding color-changing partition based on the switch status represented by the color-changing partition switch information. The color-changing activation status refers to the Boolean state configuration of whether the color-changing operation is enabled. The model rendering result generation module 240 is used to perform multi-level interpolation calculations on the color values in the color-changing partition color array based on the color-changing activation status, the original color of the diffuse map, and the channel data of the color-changing channel map to obtain the model rendering result. The model color-changing operation rendering module 250 is used to perform rendering operations on the virtual character model through a fragment shader to complete the color changing according to the model rendering result.
[0129] The specific functions and examples of each module and submodule of the device in this embodiment can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.
[0130] According to embodiments of the present invention, the above-described method of the present invention can be applied to a computer device and a readable storage medium.
[0131] Figure 10 A schematic block diagram of an example computer device 600 that can be used to implement embodiments of the present invention is shown. The computer device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The computer device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0132] like Figure 10 As shown, the computer device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the computer device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0133] Multiple components in computer device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows computer device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0134] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as a method for changing the color of a virtual character model. For example, in some embodiments, a method for changing the color of a virtual character model can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the computer device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the method for changing the color of a virtual character model described above can be performed. Alternatively, in other embodiments, the computing unit 601 may be configured by any other suitable means (e.g., by means of firmware) to perform a model recoloring method for a virtual character.
[0135] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0136] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0137] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0138] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0139] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0140] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0141] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.
[0142] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for changing the color of a virtual character model, characterized in that, include: Obtain the vertex color information, color-changing zone switch information, color-changing zone color array, diffuse map, and color-changing channel map of the virtual character; The vertex color information is encoded based on a specific channel value to determine at least two color-swap partition identifiers. The encoding process includes converting the channel value into an integer format and determining the color-swap partition identifier through bitwise operations. The color-changing enable status of each color-changing partition corresponding to the color-changing partition is determined based on the switch status represented by the color-changing partition switch information. The color-changing enable status refers to the Boolean state configuration of whether the color-changing operation is enabled. Based on the color-changing activation state, the original color of the diffuse texture, and the channel data of the color-changing channel texture, multi-level interpolation calculations are performed on the color values in the color-changing partition color array to obtain the model rendering result; Based on the rendering results of the model, the virtual character model is rendered using a fragment shader to complete the color change.
2. The method according to claim 1, characterized in that, The step of encoding the vertex color information based on specific channel values to determine at least two color-swap partition identifiers includes: Convert the specific channel values in the vertex color information into encoded values in integer format; Bitwise operations are performed on the encoded value in the integer format to separate the high-order bits and low-order bits from the encoded value; The high-order portion is determined as the first color-changing partition identifier, and the low-order portion is determined as the second color-changing partition identifier. The first color-changing partition identifier and the second color-changing partition identifier are used as indices of the corresponding color values in the color-changing partition color array.
3. The method according to claim 1, characterized in that, The step of determining the color-changing activation status of each color-changing partition corresponding to the color-changing partition identifier based on the switch status represented by the color-changing partition switch information includes: Based on the values of each color-changing partition identifier, bitwise operations are performed on the color-changing partition switch information to generate a mask value corresponding to each color-changing partition; If any of the mask values is equal to the preset valid state threshold, then the color-changing activation state of the corresponding color-changing partition is determined to be the activated state. If any of the mask values is not equal to the effective state threshold, then the color-changing enable state of the corresponding color-changing partition is determined to be disabled.
4. The method according to claim 1, characterized in that, The steps for obtaining the color-changing channel texture include: The first channel data, the second channel data, and the third channel data are sampled through the graphics rendering pipeline to generate the color-changing channel texture through image processing operations. The first channel data is used to provide interpolation weight coefficients between the two color-changing zones, the second channel data is used to provide weight coefficients for mixing the color-changing result with the original color, and the third channel data is used to provide brightness adjustment parameters.
5. The method according to claim 4, characterized in that, The process of performing multi-level interpolation calculations on the color values in the color array of the color-changing partition based on the color-changing enabled state, the original color of the diffuse texture, and the channel data of the color-changing channel texture to obtain the model rendering result includes: Based on the color-changing activation status of each color-changing partition, the color value of the corresponding color-changing partition identifier with the activation status is obtained from the color array of the color-changing partition as the target color value, and the original color of the diffuse map is used as the target color value for partitions where the color-changing operation is not enabled. Based on the data from the first channel, perform first-level interpolation calculations on at least two of the target color values to obtain intermediate color-changing results; The base color is obtained by performing a second-level interpolation calculation on the intermediate color-changing result and the original color of the diffuse texture based on the second channel data. The brightness and darkness of the base color are adjusted based on the data from the third channel to obtain the rendering result of the model.
6. The method according to claim 1, characterized in that, The fragment shader is configured with vertex attribute input parameters, material map sampling parameters, and color calculation parameters; the step of performing a rendering operation on the virtual character model through the fragment shader to complete the color change according to the model rendering result includes: Configure rendering state parameters for the fragment shader based on the model rendering results and the material properties of the virtual character; The graphics application programming interface submits drawing instructions to the graphics processor, triggering the fragment shader to perform rendering calculations based on the vertex attribute input parameters, material map sampling parameters, and color calculation parameters, according to the model rendering results, and generate pixel color data. The pixel color data is input into the frame buffer managed by the graphics system to complete the color change.
7. The method according to claim 6, characterized in that, The step of configuring rendering state parameters for the fragment shader based on the model rendering result and the material properties of the virtual character includes: The blending mode parameters are determined based on the material properties of the virtual character. These blending mode parameters are used to control the blending operation between the model rendering result and the background color. The color writing parameters are determined based on the transparency characteristics of the model rendering result. The color writing parameters are used to control the channel permissions for writing color data into the frame buffer. Based on the rendering requirements of the virtual character model, depth test parameters and template test parameters are set. The depth test parameters are used to control the pixel depth comparison operation, and the template test parameters are used to control the pixel template buffer operation.
8. A color-changing system for a virtual character model, characterized in that, include: The virtual character information acquisition module is used to acquire the vertex color information, color-changing zone switch information, color-changing zone color array, diffuse texture and color-changing channel texture of the virtual character; A color-changing partition identifier module is used to perform encoding processing on the vertex color information according to a specific channel value of the vertex color information to determine at least two color-changing partition identifiers. The encoding processing includes converting the channel value into an integer format and determining the color-changing partition identifier through bit operations. The color-changing activation status identification module is used to determine the color-changing activation status of each color-changing partition corresponding to the color-changing partition based on the switch status represented by the color-changing partition switch information. The color-changing activation status refers to the Boolean state configuration of whether the color-changing operation is enabled. The model rendering result generation module is used to perform multi-level interpolation calculations on the color values in the color array of the color-changing partition based on the color-changing enabled state, the original color of the diffuse texture, and the channel data of the color-changing channel texture to obtain the model rendering result; The model color-changing rendering module is used to perform rendering operations on the virtual character model through the fragment shader according to the model rendering result to complete the color change.
9. A computer device, characterized in that, include: At least one processor; and a memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, in, Computer instructions are used to cause a computer to perform the method according to any one of claims 1-7.
Citation Information
Patent Citations
Three-dimensional model color changing method and device
CN113223133A