Model dyeing method and device, storage medium, equipment and program product
By establishing a binding relationship between coloring parameters and using multi-channel masking technology, real-time and accurate coloring synchronization between 3D and 2D models was achieved, solving the problem of inconsistent colors between models of different dimensions and improving the visual consistency and performance of game characters.
Patent Information
- Application Number
- CN202511861825.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-02-10
AI Technical Summary
In existing technologies, the independent management of material parameters for 3D models and 2D skeletal animation models leads to inconsistent colors of the same virtual object in different dimensional representations, and there is a lack of technical solutions for real-time synchronization and high-precision color processing.
By establishing a binding relationship between coloring parameters between models of different dimensions, the coloring parameters of the first model are acquired and synchronized to the second model in real time. Parallel coloring calculations are performed using a graphics processor, and precise control is achieved by combining multi-channel coloring masks, thus realizing real-time coloring synchronization across models of different dimensions.
It achieves real-time, accurate, and consistent coloring of the same virtual object across different dimensional model representations, improving visual uniformity and enhancing coloring efficiency and performance.
Smart Images

Figure CN121505075A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, specifically to a model coloring method, apparatus, storage medium, device, and program product. Background Technology
[0002] In game development and virtual character representation, the same virtual object (such as a game character) is often represented using both 3D models and 2D skeletal animation models to meet the rendering requirements of different scenarios. For example, high-precision 3D models are used in combat scenes to obtain better lighting and spatial sense, while 2D skeletal animation is used in UI avatars, skill effects, or certain 2D rendering scenarios to save performance and maintain a consistent art style.
[0003] To enable features such as character customization, equipment coloring, rarity-based color changes, and faction identification, real-time coloring of different parts of the virtual character is required. However, because the material parameters of the 3D model and the 2D skeletal animation model are managed independently, when the coloring parameters of one (such as the 3D model) change, the other (such as the 2D skeletal animation model) cannot automatically synchronize. This results in inconsistent colors for the same character in different dimensions, affecting visual uniformity.
[0004] There is a lack of technical solutions in the relevant fields that can automatically, quickly, and accurately synchronize the real-time coloring parameters of a 3D model to a 2D skeletal animation model and complete the real-time coloring process. Summary of the Invention
[0005] This application provides a model coloring method, apparatus, storage medium, device, and program product, which establishes a coloring parameter binding relationship between model materials of different dimensions, synchronizes the real-time coloring parameters of one model to the other model, and achieves millisecond-level coloring synchronization and pixel-level high-precision consistency of the same virtual object in cross-dimensional representation.
[0006] On one hand, embodiments of this application provide a model staining method, the method comprising: In response to changes in the shading parameters of the first model material, the updated real-time shading parameters of the first model material are obtained, wherein the first model material corresponds to the first model; Based on the coloring parameter binding relationship between the first model material and the second model material, the real-time coloring parameters are synchronized to the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; Based on the synchronized real-time staining parameters, the second model is subjected to real-time staining processing.
[0007] On the other hand, embodiments of this application provide a model staining apparatus, the apparatus comprising: The acquisition unit is used to acquire the updated real-time tinting parameters of the first model material in response to the change in the tinting parameters of the first model material, wherein the first model material corresponds to the first model. The synchronization unit is used to synchronize the real-time coloring parameters to the second model material according to the coloring parameter binding relationship between the first model material and the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; A staining unit is used to perform real-time staining processing on the second model based on the synchronized real-time staining parameters.
[0008] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the model coloring method as described in any of the above embodiments.
[0009] On the other hand, embodiments of this application provide a computer device, the computer device including a processor and a memory, the memory storing a computer program, the processor executing the model staining method as described in any of the above embodiments by calling the computer program stored in the memory.
[0010] On the other hand, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the model coloring method as described in any of the above embodiments.
[0011] The embodiments of this application provide a model coloring method that responds to changes in the coloring parameters of a first model material, obtains updated real-time coloring parameters for the first model material, wherein the first model material corresponds to the first model; synchronizes the real-time coloring parameters to the second model material according to the coloring parameter binding relationship between the first model material and the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; and performs real-time coloring processing on the second model based on the synchronized real-time coloring parameters. By establishing a coloring parameter binding relationship between cross-dimensional model materials, the method can synchronize the changing real-time coloring parameters to the other model material when the real-time parameters of one model material change, thus achieving real-time and accurate consistency of the coloring effect of the same virtual object under different dimensional model representations. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a schematic diagram of the architecture of the model staining system provided in the embodiments of this application.
[0014] Figure 2 This is a schematic flowchart of the model staining method provided in the embodiments of this application.
[0015] Figure 3 This is a schematic diagram of the texture after color alignment processing for the model, as provided in this embodiment of the application. Figure 4 This is a schematic diagram illustrating the extraction process of the multi-channel staining mask provided in an embodiment of this application.
[0016] Figure 5 This is a schematic diagram of the structure of the model staining apparatus provided in the embodiments of this application.
[0017] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] This application provides a model coloring method, apparatus, storage medium, device, and program product. Specifically, the model coloring method of this application can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, smart TV, wearable smart device, smart vehicle terminal, etc. The terminal can also include a client, which can be a game client, browser client, instant messaging client, or mini-program, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0020] In this embodiment, the execution entity of the model coloring method can be a terminal device or a server. The terminal device can be a local terminal device or a client device in the aforementioned cloud gaming. This embodiment does not limit the type of execution entity.
[0021] Please see Figure 1 , Figure 1 This is a schematic diagram of the architecture of a model coloring system provided in an embodiment of this application. The system can implement the model coloring method provided in this embodiment. The system may include a terminal 1000, a server 2000, and a network 3000. The terminal 1000 and the server 2000 can interact with each other via the network 3000, which may be a wide area network (WAN), a local area network (LAN), or a combination of both.
[0022] Terminal 1000 can be an electronic device with graphics rendering capabilities, such as a smartphone, tablet, personal computer, or game console, running a game client or a virtual character display application. Terminal 1000 loads at least two different dimensional models of the same virtual object, including a first model (preferably a 3D model) and a second model (e.g., a Spine 2D skeletal animation model). The first model corresponds to a first model material, and the second model corresponds to a second model material, with a pre-established color parameter binding relationship between the first model material and the second model material.
[0023] Server 2000 can be used as a cloud gaming server, a game backend server, or a dedicated rendering computing server.
[0024] In some embodiments, when a player triggers a character coloring operation (such as equipment coloring, faction color changing, rarity color changing, etc.) in the terminal 1000, causing the coloring parameters of the first model material to change, the server 2000 obtains the updated real-time coloring parameters of the first model material.
[0025] Server 2000 synchronizes the real-time shading parameters to the second model material based on the pre-stored or real-time queried binding relationship between the first and second model materials. Subsequently, server 2000 performs real-time shading processing on the second model based on the synchronized real-time shading parameters. Specifically, when rendering the second model, server 2000's graphics rendering pipeline passes the synchronized real-time shading parameters to the corresponding material shader of the second model. The shader then performs real-time shading rendering of the second model, generating a shading-processed rendering result, which is pushed to terminal 1000 for display in real-time via network 3000, thus ensuring that the shading effect of the same virtual object is completely consistent in both the 3D model and the 2D skeletal animation model.
[0026] Through the above system implementation, when any change occurs in the coloring parameters of the first model, the system can automatically and in real time synchronize the change to the second model, and complete the real-time coloring processing of the second model on the terminal or server, so as to achieve complete unification and instant update of the coloring parameters of the same virtual object in different dimensional models.
[0027] Please see Figure 2 , Figure 2 This is a flowchart illustrating the model coloring method provided in an embodiment of this application. It should be noted that the steps shown may be executed in a different logical order than that shown in the flowchart. The method may include the following steps: Step 110: In response to the change in the shading parameters of the first model material, obtain the updated real-time shading parameters of the first model material, wherein the first model material corresponds to the first model.
[0028] In the embodiments of this application, the first model and the second model are two different dimensions of the same virtual object, used to represent different dimensional representations of the same virtual object (e.g., a game character). The first model material and the second model material are attribute layers that control the visual representation of the first model and the second model, respectively.
[0029] In one specific embodiment provided in this application, the first model and the second model are, for example, a three-dimensional model and a two-dimensional skeletal animation model.
[0030] During gameplay, users or the game system may perform coloring operations on virtual objects, such as changing the color of clothing, hair, or skin. When the coloring parameters of the first model's material change, it is necessary to obtain the updated real-time coloring parameters in a timely manner so that they can be synchronized to the second model.
[0031] In some embodiments, in response to a change in the shading parameters of the first model material, the updated real-time shading parameters of the first model material are obtained, including: The parameter synchronization manager monitors the changes in the coloring state of the first model's material in real time. In response to the parameter synchronization manager detecting a change in the coloring state of the first model material, the real-time coloring parameters of the first model material are read through the parameter synchronization manager.
[0032] In some embodiments, the parameter synchronization manager is a dedicated functional module for managing and synchronizing shading parameters. The parameter synchronization manager monitors the shading status of the first model material in real time through an event listening mechanism or a polling mechanism. When a change in the shading parameters (such as hue, saturation, and brightness) of the first model material is detected, the parameter synchronization manager immediately triggers a parameter reading operation to obtain the latest shading parameter values from the first model material. This real-time monitoring mechanism ensures that changes in shading parameters are captured promptly, providing a data foundation for subsequent parameter synchronization.
[0033] In some embodiments, the real-time color parameters are based on the HSV color model and include at least one of hue, saturation, and lightness.
[0034] The HSV color model is a color representation method based on human visual perception. Compared to the traditional RGB color model, the HSV color model better aligns with human intuitive color perception, facilitating color adjustment and dyeing operations. Hue represents the basic attributes of color, such as red, green, and blue; saturation represents the purity or vividness of a color; and lightness represents the brightness or darkness of a color. By adjusting HSV parameters, a wide variety of dyeing effects can be achieved. For example, changing only the hue can turn red clothing blue, while keeping saturation and lightness constant ensures consistent color gradation before and after dyeing.
[0035] Step 120: Based on the coloring parameter binding relationship between the first model material and the second model material, synchronize the real-time coloring parameters to the second model material. The second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object.
[0036] In this embodiment, a pre-established coloring parameter binding relationship is established between the first model material and the second model material. This coloring parameter binding relationship defines the correspondence between the coloring areas of the first model and the coloring areas of the second model, as well as the mapping rules for the coloring parameters used in each coloring area. For example, the coloring area of the "top" of the first model (3D model) is bound to the coloring area of the "top" of the second model (Spine 2D model). When the color parameters of the top of the 3D model change, the parameters will automatically be synchronized to the top area of the Spine model.
[0037] Specifically, in step 120, after obtaining the real-time coloring parameters of the first model material, the parameter synchronization manager searches for the corresponding second model material according to the preset coloring parameter binding relationship, and then writes the real-time coloring parameters into the corresponding attribute of the second model material. This synchronization process is completed in milliseconds, ensuring that the coloring effects of the first and second models are consistent.
[0038] It should be noted that in games or applications, the same virtual object may be presented in 2D and 3D forms in different scenes or perspectives. For example, a 3D model may be used when displaying the main interface of a game, while Spine 2D animation may be used in a battle scene. Through the parameter synchronization mechanism of this application, regardless of which display mode the user performs coloring operations on the character, the character coloring effect in the other display mode can be kept synchronized in real time, providing the user with a consistent visual experience.
[0039] Step 130: Based on the synchronized real-time staining parameters, perform real-time staining processing on the second model.
[0040] After obtaining the synchronized real-time coloring parameters, the second model needs to be colored in real-time to ensure that the visual effect of the second model is consistent with that of the first model.
[0041] In some embodiments, the second model is subjected to real-time staining processing based on synchronized real-time staining parameters, including: Based on the synchronized real-time coloring parameters, the second model is colored in real-time using a graphics processor.
[0042] In this embodiment, a graphics processing unit (GPU) is introduced to perform real-time coloring processing on the second model. GPUs possess powerful parallel computing capabilities, enabling them to handle coloring calculations for a large number of pixels simultaneously. Compared to using a CPU for coloring calculations, the GPU's parallel processing significantly improves coloring efficiency.
[0043] When performing real-time coloring on the second model, the process is executed in parallel by the GPU during each frame rendering, thereby achieving efficient real-time coloring effects.
[0044] In some embodiments, the second model is subjected to real-time staining processing based on the synchronized real-time staining parameters, including steps 1301 to 1302: Step 1301: Obtain the pre-generated multi-channel staining mask of the second model, wherein different channels of the multi-channel staining mask are used to define different staining regions in the second model.
[0045] In this embodiment, a multi-channel shading mask is a texture image used to precisely control shading regions. The multi-channel shading mask utilizes different color channels of the image (such as R, G, B, and A channels) to store masking information for different shading regions. The pixel value of each channel (typically ranging from 0-1 or 0-255) represents the shading weight or intensity of the shading region corresponding to that pixel location. A higher pixel value indicates a greater influence of the corresponding shading parameters on the pixel; a pixel value of 0 indicates that the pixel does not participate in the shading of that region.
[0046] For example, for a game character, the R channel can be used to store the mask for the "hair" area, the G channel for the "shirt" area, the B channel for the "pants" area, and the A channel for the "shoes" area. In this way, a single multi-channel mask texture can control four independent shading areas simultaneously, saving texture resources while providing pixel-level precise shading control.
[0047] In some embodiments, the method for generating a multi-channel staining mask includes the following steps 01 to 03: Step 01: Obtain the original texture of the second model.
[0048] The original texture of the second model is the base texture image used by the second model, which contains the basic appearance information of the virtual object.
[0049] Step 02: Based on the color of the first model, perform color alignment processing on the original texture to obtain the color-aligned texture of the second model.
[0050] Specifically, the purpose of color alignment is to ensure that the base color of the second model is consistent with the base color of the first model. Since 2D and 3D textures may be created by different artists or use different color configurations, color alignment is necessary before color synchronization to ensure consistency in the subsequent coloring effect. Color alignment can be achieved by adjusting parameters such as hue, saturation, and brightness of the original texture to match the colors of corresponding areas on the first model.
[0051] Please see Figure 3 , Figure 3This is a schematic diagram of the texture after color alignment processing for the model, as described in this embodiment. In actual processing, due to differences in the original art production environment between the 2D Spine model and the 3D model (e.g., different color temperatures and brightness), direct coloring will lead to color differences. Therefore, this embodiment first uses the base color of the 3D model as a reference to uniformly correct the hue, saturation, and brightness of the original texture of the Spine model, generating a texture as shown below. Figure 3 The color-aligned texture shown is used to preserve the character's visual details (such as dragon scales and wing textures) and ensure that the base color remains consistent with the 3D model when subsequent coloring parameters are overlaid.
[0052] Step 03: Mark and extract different stained areas on the color alignment map to obtain a multi-channel stained mask.
[0053] Specifically, in step 03, on the color alignment map, the stained areas of the virtual object that need to be stained (such as hair, clothes, etc.) are selected, and the selection information of each stained area is stored in different channels of the mask texture.
[0054] Please see Figure 4 , Figure 4 This is a schematic diagram illustrating the extraction process of the multi-channel staining mask provided in an embodiment of this application. Figure 4 The left side shows a breakdown of the Spine model's components (such as the dragon's horns, body slices, etc.), and the right side shows the corresponding generated single-channel mask image (e.g., R-channel mask). During the production process, technicians or automated scripts will select... Figure 4 The areas on the left that require specific coloring (e.g., body parts that need to be dyed red) are marked as white (pixel value 1 or 255) in the mask texture, while areas that do not need coloring are marked as black (pixel value 0). For example... Figure 4 As shown on the right, the white area precisely defines the scope of the coloring parameters. Different coloring areas (such as the body, wings, and horns) can correspond to different channels of the mask texture (R, G, B, A), thus enabling a single texture to control the precise coloring of four independent areas, effectively preventing color overflow onto the background or other areas that do not need to be changed. Through the mask generation process described above, a precise multi-channel staining mask can be pre-made for the second model, providing a basis for regional control in subsequent real-time staining processing.
[0055] Step 1302: Based on the multi-channel staining mask and the synchronized real-time staining parameters, perform real-time staining processing on the second model.
[0056] After obtaining the multi-channel staining mask and synchronized real-time staining parameters corresponding to the second model, the second model can be subjected to real-time staining processing.
[0057] In some embodiments, the second model is subjected to real-time staining processing based on a multi-channel staining mask and synchronized real-time staining parameters, including the following steps 001 to 003: Step 001: For the current rendered pixel of the second model, sample multiple channels of the multi-channel shading mask through the shader to obtain the mask value of the current rendered pixel on each channel.
[0058] Specifically, in the GPU rendering pipeline, the shader program processes each pixel of the second model. For the currently rendered pixel, the shader first samples the pixel value at the corresponding position from the multi-channel shading mask based on the texture coordinates of the current rendered pixel. Since the mask texture is multi-channel, a single sampling operation can obtain the mask values of the current rendered pixel in each of the R, G, B, and A channels. For example, a sampled value of (0.8, 0.0, 0.2, 0.0) indicates that the current rendered pixel mainly belongs to the shading region corresponding to the R channel (mask value 0.8), partially belongs to the shading region corresponding to the B channel (mask value 0.2), and does not belong to the shading regions corresponding to the G and A channels.
[0059] Step 002: Based on the mask values on each channel and the synchronized real-time shading parameters, perform shading calculations based on color space transformation on the current rendered pixel.
[0060] Specifically, first, the original color of the current rendered pixel is converted from the RGB color space to the HSV color space. Then, based on the mask value of each channel and the corresponding coloring parameters, the HSV components are weighted and adjusted. For example, if the R channel corresponds to the "hair" region, its coloring parameters are hue shift +30 degrees, saturation increase of 0.1, and lightness unchanged, and the current rendered pixel's mask value in the R channel is 0.8, then the hue value of the current rendered pixel increases by 30 × 0.8 = 24 degrees, and the saturation increases by 0.1 × 0.8 = 0.08. If the current rendered pixel belongs to multiple coloring regions (i.e., the mask values of multiple channels are all greater than 0), then the coloring effects of each channel need to be combined and calculated. Finally, the adjusted HSV color is converted back to the RGB color space to obtain the final coloring result.
[0061] Step 003: Apply the shading calculation results obtained from the shading calculation to the current rendering pixel.
[0062] Specifically, the shader outputs the calculated target color value as the final rendered color of the current pixel, completing the shading process for that pixel. Since the GPU can process a large number of pixels in parallel, the above shading calculation process can complete the processing of all visible pixels in the second model in a very short time, achieving real-time updates to the shading effect.
[0063] All of the above technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.
[0064] The model coloring method provided in this application achieves millisecond-level synchronization of coloring parameters between the first and second models through a parameter synchronization manager, ensuring color consistency of the same virtual object in different dimensional representations. In addition, pixel-level coloring area control is achieved through multi-channel coloring masking, avoiding color overflow or omission problems that are easy to occur in traditional solutions. The coloring calculation is performed using GPU parallel processing, which can greatly improve performance compared to traditional CPU solutions and can meet the performance requirements of real-time applications such as games.
[0065] The embodiments of this application provide a model coloring method that responds to changes in the coloring parameters of a first model material, obtains updated real-time coloring parameters for the first model material, wherein the first model material corresponds to the first model; synchronizes the real-time coloring parameters to the second model material according to the coloring parameter binding relationship between the first model material and the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; and performs real-time coloring processing on the second model based on the synchronized real-time coloring parameters. By establishing a coloring parameter binding relationship between cross-dimensional model materials, the method can synchronize the changing real-time coloring parameters to the other model material when the real-time parameters of one model material change, thus achieving real-time and accurate consistency of the coloring effect of the same virtual object under different dimensional model representations.
[0066] To facilitate better implementation of the model staining method of this application, this application also provides a model staining apparatus. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of the model staining apparatus provided in an embodiment of this application. The model staining apparatus 300 may include: The acquisition unit 310 is used to acquire the updated real-time tinting parameters of the first model material in response to the change in the tinting parameters of the first model material, wherein the first model material corresponds to the first model. Synchronization unit 320 is used to synchronize real-time dyeing parameters to the second model material according to the dyeing parameter binding relationship between the first model material and the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; The staining unit 330 is used to perform real-time staining processing on the second model based on the synchronized real-time staining parameters.
[0067] In some embodiments, when the device is used to obtain updated real-time tinting parameters of the first model material in response to a change in the tinting parameters of the first model material, it is specifically used for: The parameter synchronization manager monitors the changes in the coloring state of the first model's material in real time. In response to the parameter synchronization manager detecting a change in the coloring state of the first model material, the real-time coloring parameters of the first model material are read through the parameter synchronization manager.
[0068] In some embodiments, when the apparatus is used to perform real-time staining processing on the second model based on synchronized real-time staining parameters, it is specifically used for: Based on the synchronized real-time coloring parameters, the second model is colored in real-time using a graphics processor.
[0069] In some embodiments, when the apparatus is used to perform real-time staining processing on the second model based on synchronized real-time staining parameters, it is specifically used for: Obtain a pre-generated multi-channel staining mask for the second model, wherein different channels of the multi-channel staining mask are used to define different staining regions in the second model; Based on multi-channel staining masking and synchronized real-time staining parameters, the second model is subjected to real-time staining processing.
[0070] In some embodiments, when the device is used to perform real-time staining processing on the second model based on a multi-channel staining mask and synchronized real-time staining parameters, it is specifically used for: For the current rendered pixel of the second model, multiple channels of the multi-channel shading mask are sampled by the shader to obtain the mask value of the current rendered pixel on each channel; Based on the mask values on each channel and the synchronized real-time coloring parameters, perform coloring calculations based on color space transformation on the current rendered pixel; Apply the shading calculation results obtained from the shading calculation to the current rendering pixel.
[0071] In some embodiments, the apparatus is further configured to: Obtain the original texture of the second model; Based on the colors of the first model, the original texture is color-aligned to obtain the color-aligned texture of the second model. On the color-aligned texture, different stained areas are marked and extracted to obtain a multi-channel stained mask.
[0072] In some embodiments, the real-time color parameters are based on the HSV color model and include at least one of hue, saturation, and lightness.
[0073] Each unit in the aforementioned model staining apparatus can be implemented entirely or partially through software, hardware, or a combination thereof. These units can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each unit.
[0074] The model coloring device 300 can be integrated into a terminal or server that has storage and a processor and thus computing power, or the model coloring device 300 can be the terminal or server.
[0075] Optionally, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0076] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device may include: a communication interface 401, a memory 402, a processor 403, and a communication bus 404. The communication interface 401, memory 402, and processor 403 communicate with each other via the communication bus 404. The communication interface 401 is used for data communication between the computer device and external devices. The memory 402 can be used to store software programs and modules, and the processor 403 runs the software programs and modules stored in the memory 402, such as the software programs for corresponding operations in the aforementioned method embodiments.
[0077] In some embodiments, the processor 403 may invoke software programs and modules stored in the memory 402 to perform the following operations: in response to a change in the shading parameters of the first model material, obtain the updated real-time shading parameters of the first model material, wherein the first model material corresponds to the first model; according to the shading parameter binding relationship between the first model material and the second model material, synchronize the real-time shading parameters to the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; and perform real-time shading processing on the second model based on the synchronized real-time shading parameters.
[0078] In some embodiments, the computer device 400 may be integrated into a terminal or server that has storage and a processor, thus possessing computing capabilities; or the computer device 400 may be the terminal or server. The terminal may be a smartphone, tablet, laptop, smart TV, smart speaker, wearable smart device, personal computer, or other similar device. The server may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0079] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to a computer device, and the computer program causes the computer device to execute the corresponding processes in the model coloring method of the embodiments of this application; for the sake of brevity, these will not be elaborated further here.
[0080] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding process in the model coloring method of the embodiments of this application. For simplicity, further details are omitted here.
[0081] This application also provides a computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding process in the model coloring method of this application. For brevity, further details are omitted here.
[0082] It should be understood that the processor in this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0083] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0084] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0085] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0086] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0087] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0088] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0089] In addition, the functional units in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0090] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer or a server) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0091] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A model staining method, characterized in that, The method includes: In response to changes in the shading parameters of the first model material, the updated real-time shading parameters of the first model material are obtained, wherein the first model material corresponds to the first model; Based on the coloring parameter binding relationship between the first model material and the second model material, the real-time coloring parameters are synchronized to the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; Based on the synchronized real-time staining parameters, the second model is subjected to real-time staining processing.
2. The model staining method as described in claim 1, characterized in that, The step of obtaining the updated real-time tinting parameters of the first model material in response to changes in the tinting parameters of the first model material includes: The parameter synchronization manager monitors the changes in the coloring state of the first model's material in real time. In response to the parameter synchronization manager detecting a change in the shading state of the first model material, the real-time shading parameters of the first model material are read through the parameter synchronization manager.
3. The model staining method as described in claim 1, characterized in that, The real-time staining process for the second model based on the synchronized real-time staining parameters includes: Based on the synchronized real-time coloring parameters, the second model is subjected to real-time coloring processing via a graphics processor.
4. The model staining method as described in claim 1, characterized in that, The real-time staining process for the second model based on the synchronized real-time staining parameters includes: Obtain a pre-generated multi-channel staining mask for the second model, wherein different channels of the multi-channel staining mask are used to define different staining regions in the second model; Based on the multi-channel staining mask and the synchronized real-time staining parameters, the second model is subjected to real-time staining processing.
5. The model staining method as described in claim 4, characterized in that, The real-time staining process for the second model based on the multi-channel staining mask and the synchronized real-time staining parameters includes: For the current rendered pixel of the second model, multiple channels of the multi-channel tinting mask are sampled by the shader to obtain the mask value of the current rendered pixel on each channel; Based on the mask values on each channel and the synchronized real-time coloring parameters, a coloring calculation based on color space transformation is performed on the current rendered pixel. The coloring calculation result obtained from the coloring calculation is applied to the current rendering pixel.
6. The model staining method as described in claim 4, characterized in that, The method further includes: Obtain the original texture of the second model; Based on the color of the first model, the original texture is color-aligned to obtain the color-aligned texture of the second model; On the color alignment map, the different stained regions are marked and extracted to obtain the multi-channel stained mask.
7. The model staining method as described in claim 1, characterized in that, The real-time coloring parameters are based on the HSV color model and include at least one of hue, saturation, and lightness.
8. A model staining apparatus, characterized in that, The device includes: The acquisition unit is used to acquire the updated real-time tinting parameters of the first model material in response to the change in the tinting parameters of the first model material, wherein the first model material corresponds to the first model. The synchronization unit is used to synchronize the real-time coloring parameters to the second model material according to the coloring parameter binding relationship between the first model material and the second model material, wherein the second model material corresponds to the second model, and the first model and the second model are two different dimensions of the same virtual object; A staining unit is used to perform real-time staining processing on the second model based on the synchronized real-time staining parameters.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the model staining method as described in any one of claims 1-7.
10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program, and the processor executes the model staining method according to any one of claims 1-7 by calling the computer program stored in the memory.
11. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the model coloring method according to any one of claims 1-7.