Data processing methods, apparatus, electronic devices and readable media

By obtaining the current mesh position and texture map position of the virtual model, collecting and blending the color information of the rendered texture, the problem of the virtual model brush not being able to achieve color gradients is solved, and the real-time color gradient coloring effect of the virtual model is realized.

CN114494666BActive Publication Date: 2025-11-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210111723.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2025-11-14
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

Existing virtual model brushes cannot achieve a gradient effect from dark to light color in a single stroke, thus failing to meet users' needs for color gradients.

Method used

By responding to touch operations, the current mesh position of the virtual model is obtained, the texture map position is determined, the color information in the rendered texture is collected, and the color of the historical touch area is mixed with the color of the current texture position to update the color of the texture map to achieve color gradient.

Benefits of technology

It achieves real-time color gradient coloring of virtual models in three-dimensional space, meeting users' needs for color gradients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494666B_ABST
    Figure CN114494666B_ABST
Patent Text Reader

Abstract

This invention provides a data processing method and apparatus. The method includes: responding to a touch operation applied to a virtual model; obtaining the current grid position of the touch operation on the model mesh of the virtual model at the (n+1)th time; determining the current texture position of the texture map of the virtual model based on the current grid position; acquiring the rendered texture corresponding to the touch operation at the nth time; obtaining the color information of the touch operation in the historical touch area in the rendered texture, wherein the rendered texture is a texture generated based on the color at the historical position of the touch operation in the texture map; mixing the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position; updating the color at the current texture position of the texture map using the target color; and rendering the virtual model at the (n+1)th time based on the updated texture map. This enables a color gradient smearing effect on the virtual model in three-dimensional space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a data processing method, a data processing apparatus, an electronic device, and a computer-readable medium. Background Technology

[0002] Generally, when coloring virtual models, brushes are typically used. However, brushes for virtual models usually only fill the area painted with a single color, and cannot create a color gradient effect with a single brush stroke. For example, when applying eyeshadow to the face of a 3D human model, existing brushes cannot show the gradient effect of the eyeshadow color from dark to light during a single application. Summary of the Invention

[0003] The present invention provides a data processing method, apparatus, electronic device, and computer-readable storage medium that overcomes or at least partially solves the above-mentioned problems.

[0004] This invention discloses a data processing method, including:

[0005] In response to a touch operation applied to a virtual model, the current grid position of the touch operation in the model grid of the virtual model is obtained at the current (n+1)th time, where n≥1;

[0006] The current texture position of the texture map of the virtual model is determined based on the current mesh position;

[0007] Collect the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map.

[0008] The color of the historical touch area is mixed with the current color of the current texture position to obtain the target color of the current texture position;

[0009] Update the color at the current texture position of the texture map using the target color;

[0010] The virtual model at time n+1 is rendered based on the updated texture map.

[0011] Optionally, the step of determining the current texture position of the texture map of the virtual model based on the current mesh position includes:

[0012] Determine whether the preset area mask overlaps with the current grid position;

[0013] If the preset region mask overlaps with the current grid position, the region in the current grid position that does not overlap with the region mask is taken as the target grid position;

[0014] The current texture position of the texture map of the virtual model is determined based on the target mesh position.

[0015] Optionally, the step of acquiring the rendering texture corresponding to the touch operation at time n includes:

[0016] A virtual camera is used to capture the historical touch area corresponding to the touch operation at time n, and the rendered texture corresponding to time n is obtained.

[0017] Optionally, the step of acquiring the rendering texture corresponding to the touch operation at time n includes:

[0018] Determine whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n;

[0019] If the preset region mask overlaps with the historical touch area corresponding to the touch operation at time n, the area outside the overlap between the historical touch area and the region mask is collected to obtain the rendered texture.

[0020] Optionally, the method further includes:

[0021] For the first moment, in response to a touch operation applied to the virtual model, the current grid position of the touch operation on the model grid of the virtual model is obtained at the first moment;

[0022] The current texture position of the texture map of the virtual model is determined based on the current mesh position;

[0023] The color at the current texture position of the texture map is updated by using a preset initial color;

[0024] The virtual model at the first moment is rendered based on the updated texture map.

[0025] Optionally, the step of mixing the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position includes:

[0026] Determine the first blending ratio corresponding to the historical touch area and the second blending ratio corresponding to the current texture position;

[0027] Based on the first mixing ratio and the second mixing ratio, the color of the historical touch area is mixed with the current color corresponding to the current texture position to obtain the target color of the current texture position.

[0028] This invention also provides a data processing apparatus, comprising:

[0029] The model position determination module is used to respond to a touch operation applied to the virtual model and obtain the current grid position of the touch operation in the model grid of the virtual model at the current (n+1)th time, where n≥1;

[0030] The texture position determination module is used to determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0031] The rendering texture acquisition module is used to acquire the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map.

[0032] A mixing module is used to mix the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position;

[0033] The color update module is used to update the color at the current texture position of the texture map using the target color;

[0034] The model update module is used to render the virtual model at the (n+1)th time step based on the updated texture map.

[0035] Optionally, the texture location determination module includes:

[0036] The first overlap determination submodule is used to determine whether a preset area mask overlaps with the current grid position;

[0037] The target grid position determination submodule is used to determine the target grid position if a preset region mask overlaps with the current grid position, and the region outside the region mask in the current grid position is taken as the target grid position.

[0038] The texture position determination submodule is used to determine the current texture position of the texture map of the virtual model based on the target mesh position.

[0039] Optionally, the rendering texture acquisition module includes:

[0040] The first rendering texture acquisition submodule is used to capture the historical touch area corresponding to the touch operation at time n using a virtual camera, and obtain the rendering texture corresponding to time n.

[0041] Optionally, the rendering texture acquisition module includes:

[0042] The second overlap determination submodule is used to determine whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n.

[0043] The second rendering texture acquisition submodule is used to acquire the area outside the overlap between the preset area mask and the historical touch area corresponding to the touch operation at time n, and obtain the rendering texture.

[0044] Optionally, the device further includes:

[0045] The first-moment model position determination module is used to, in response to a touch operation applied to the virtual model at the first moment, obtain the current grid position of the touch operation on the model grid of the virtual model at the first moment.

[0046] The first-moment texture position determination module is used to determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0047] An initial color update module is used to update the color at the current texture position of the texture map using a preset initial color;

[0048] The first-moment rendering module is used to render the virtual model at the first moment based on the updated texture map.

[0049] Optionally, the hybrid module includes:

[0050] The ratio determination submodule is used to determine the first mixing ratio corresponding to the historical touch area and the second mixing ratio corresponding to the current texture position;

[0051] The mixing submodule is used to mix the color of the historical touch area with the current color corresponding to the current texture position according to the first mixing ratio and the second mixing ratio to obtain the target color of the current texture position.

[0052] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0053] The memory is used to store computer programs;

[0054] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.

[0055] This invention also discloses one or more computer-readable media storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.

[0056] The embodiments of the present invention have the following advantages:

[0057] The data processing method of this invention responds to touch operations applied to a virtual model, obtains the current grid position of the touch operation on the model mesh of the virtual model at the (n+1)th time, where n≥1; determines the current texture position of the texture map of the virtual model based on the current grid position; collects the rendering texture corresponding to the touch operation at the nth time, obtains the color information of the touch operation in the historical touch area in the rendering texture, and the rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map; mixes the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position; updates the color of the current texture position of the texture map with the target color; and renders the virtual model at the (n+1)th time based on the updated texture map, thereby achieving a color gradient painting effect on the virtual model in three-dimensional space. Attached Figure Description

[0058] Figure 1 This is a flowchart of the steps of a data processing method provided in an embodiment of the present invention;

[0059] Figure 2 This is a flowchart of the steps of a data processing method provided in an embodiment of the present invention;

[0060] Figure 3 This is a schematic diagram of a region masking method provided in an embodiment of the present invention.

[0061] Figure 4 This is a schematic diagram of a virtual model rendering provided in an embodiment of the present invention.

[0062] Figure 5 This is a structural block diagram of a data processing device provided in an embodiment of the present invention;

[0063] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present invention;

[0064] Figure 7 This is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. Detailed Implementation

[0065] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0066] In this embodiment of the invention, when it is necessary to apply makeup to a virtual human body model or add ink-wash style textures to a virtual model, users can expect to see color gradient effects displayed in real time during the coloring process.

[0067] If the virtual model is colored after a single operation is completed, and the start and end points of the single operation are determined, then the start and end colors of the single operation can be determined separately, and the color of the middle part of the single operation can be determined based on the start and end colors to form a color gradient effect.

[0068] However, users often expect to observe the coloring effect in real time during the coloring process. Therefore, this embodiment of the invention identifies the area where the touch operation is located at each moment in real time, and mixes the color of the touch in the historical touch area with the current color of the current texture position to obtain the target color of the current texture position, thereby realizing real-time coloring of the virtual model through virtual operation.

[0069] Furthermore, since virtual models are typically uneven, continuous positional changes on a virtual model may involve positional changes in multiple directions within three-dimensional space. Consequently, when mapped to the corresponding texture map of the virtual model, discontinuous positional changes may occur within the texture map. During the coloring process of the virtual model, given the discontinuous texture map, it is impossible to easily determine the offset of the virtual operation at each moment. Therefore, it is impossible to determine the region where the virtual model was located at the previous moment based on the offset and extract the color of that region. Therefore, this embodiment of the invention pre-collects the texture map color of the region where the virtual operation was located at the previous moment, obtaining a rendered texture recording the color of that region. Subsequently, the color corresponding to the region where the virtual operation was located at the previous moment can be easily determined based on the rendered texture, thus simplifying color mixing.

[0070] Reference Figure 1 The diagram illustrates a flowchart of a data processing method provided in an embodiment of the present invention, which may specifically include the following steps:

[0071] Step 101: In response to a touch operation applied to the virtual model, obtain the current grid position of the touch operation on the model grid of the virtual model at the current (n+1)th time, where n≥1;

[0072] In this embodiment of the invention, the virtual model can be a three-dimensional model. For example, a three-dimensional human body model, animal model, plant model, architectural model, etc.

[0073] If a user needs to color the virtual model, they can perform touch operations on the virtual model. Each touch operation can be a continuous, uninterrupted movement, that is, each touch operation can be considered as a single stroke, which can draw continuous patterns.

[0074] During the period of time when the user performs a touch operation, the current grid position of the touch operation on the model grid of the virtual model at the current n+1 time can be obtained in real time to determine the position that needs to be colored.

[0075] In this process, since touch operation can add a preset color to the virtual model at the first moment, and then from the second moment onwards, as the touch operation moves, the added color is mixed with the color of the virtual model's texture to achieve a coloring effect. Therefore, n≥1.

[0076] Specifically, the virtual model can be displayed on a screen in an electronic device. Users can make touch operations through the touch screen and peripheral devices connected to the electronic device, such as a mouse, stylus, or keyboard. The touch operation can point to a specific location on the screen, thus pointing to a specific location within the virtual model displayed on the screen, thereby determining the current grid position of the touch operation within the model's grid.

[0077] In the specific implementation, the user's touch operation can be used to control a brush mask. The current position covered by the brush mask can be regarded as the current grid position of the touch operation on the model grid of the virtual model.

[0078] Step 102: Determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0079] After determining the current grid position of the touch operation, the current texture position of the virtual model's texture map corresponding to the current grid position can be further determined to determine the position in the texture map that needs to be colored.

[0080] In a practical implementation, the correspondence between the grid position of the virtual model's mesh in three-dimensional space and the texture position of the texture map can be preset. Thus, after determining the current grid position of the model mesh corresponding to the touch operation, the current texture position of the virtual model's texture map corresponding to the current grid position can be determined based on the preset correspondence.

[0081] Step 103: Collect the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map.

[0082] Specifically, in order to achieve the effect of color gradient, the color of the historical touch area where the touch operation is located at time n can be mixed with the current color of the current texture position, so that the target color determined at each time is based on the color of the historical touch area, thereby showing the effect of gradual color change.

[0083] Therefore, the rendered texture corresponding to the nth moment of the touch operation can be collected in advance. This allows for the recording of the target color from the previous moment, assuming the texture map's position change is discontinuous, by pre-collecting the color generated at the historical position of the touch operation on the texture map. Specifically, the rendered texture contains various information such as the size, dimensions, and color of the historical touch area. Thus, the color information of the touch operation within the historical touch area can be obtained from the rendered texture.

[0084] Step 104: Mix the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position;

[0085] After obtaining the colors of the historical touch areas through texture rendering, the current texture position can be determined from the texture map, and the current color of the current texture position can be extracted. Then, the colors of the historical touch areas can be blended with the current color of the current texture position to determine the target color of the current texture position.

[0086] Step 105: Update the color at the current texture position of the texture map using the target color;

[0087] After determining the target color to be added to the current texture position, the color at the current texture position in the texture map is updated using the target color, thereby completing the coloring of the texture corresponding to the current mesh position in the virtual model.

[0088] Since the target color at the current texture position is determined based on the texture color corresponding to the historical touch area at time n (the previous touch operation) and the texture color corresponding to the current touch area at time n+1, the target color can be changed based on the colors of the historical touch areas, while referencing the current color at the current texture position. This allows for simplified color selection based on the colors of the historical touch areas, while also achieving a good blend with the current color of the virtual model, resulting in a natural color gradient effect.

[0089] Step 106: Render the virtual model at the (n+1)th time step according to the updated texture map.

[0090] After updating the color at the current texture position in the texture map, the updated texture map can be used to render the virtual model at the (n+1)th time step. This allows for the real-time display of the coloring effect of the virtual model during the process of coloring the virtual model through touch operation, thereby providing users with the function of real-time coloring and painting of virtual models in three-dimensional space.

[0091] The data processing method of this invention responds to touch operations applied to a virtual model, obtains the current grid position of the touch operation on the model mesh of the virtual model at the (n+1)th time, where n≥1; determines the current texture position of the texture map of the virtual model based on the current grid position; collects the rendering texture corresponding to the touch operation at the nth time, obtains the color information of the touch operation in the historical touch area in the rendering texture, and the rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map; mixes the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position; updates the color of the current texture position of the texture map with the target color; and renders the virtual model at the (n+1)th time based on the updated texture map, thereby achieving a color gradient painting effect on the virtual model in three-dimensional space.

[0092] Reference Figure 2 The diagram illustrates a flowchart of a data processing method provided in an embodiment of the present invention, which may specifically include the following steps:

[0093] Step 201: In response to a touch operation applied to the virtual model, obtain the current grid position of the touch operation in the model grid of the virtual model at the current (n+1)th time, where n≥1;

[0094] If a user needs to color the virtual model, they can perform touch operations on the virtual model. Each touch operation can be a continuous, uninterrupted movement, that is, each touch operation can be considered as a single stroke, which can draw continuous patterns.

[0095] During the period of time when the user performs a touch operation, the current grid position of the touch operation on the model grid of the virtual model at the current n+1 time can be obtained in real time to determine the position that needs to be colored.

[0096] In this process, since touch operation can add a preset color to the virtual model at the first moment, and then from the second moment onwards, as the touch operation moves, the added color is mixed with the color of the virtual model's texture to achieve a coloring effect. Therefore, n≥1.

[0097] Specifically, the virtual model can be displayed on a screen in an electronic device. Users can make touch operations through the touch screen and peripheral devices connected to the electronic device, such as a mouse, stylus, or keyboard. The touch operation can point to a specific location on the screen, thus pointing to a specific location within the virtual model displayed on the screen, thereby determining the current grid position of the touch operation within the model's grid.

[0098] In the specific implementation, the user's touch operation can be used to control a brush mask. The current position covered by the brush mask can be regarded as the current grid position of the touch operation on the model grid of the virtual model.

[0099] In one example of the present invention, the method further includes:

[0100] S11, for the first moment, in response to the touch operation applied to the virtual model, obtain the current grid position of the touch operation on the model grid of the virtual model at the first moment;

[0101] To achieve the effect of coloring and painting the model, the virtual model can be colored at the first moment. Then, as the touch operation moves in subsequent moments, other parts of the virtual model are colored based on the color added at the first moment, thus achieving the effect of naturally spreading the added color to other areas.

[0102] Therefore, for the first moment, in response to a touch operation applied to the virtual model, the current grid position of the touch operation on the model grid of the virtual model at the first moment can be obtained, so as to determine the position of the virtual model that needs to be colored.

[0103] S12, determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0104] After determining the current grid position of the touch operation on the virtual model's model mesh at the first moment, in order to color the virtual model, the current texture position corresponding to the current grid position can be further determined in the texture map of the virtual model.

[0105] Specifically, a pre-defined correspondence is established between the grid position of the virtual model's mesh in three-dimensional space and the texture position of the texture map. Thus, after determining the current grid position of the model mesh corresponding to the touch operation, the current texture position of the virtual model's texture map corresponding to the current grid position can be determined based on the pre-defined correspondence.

[0106] S13, update the color at the current texture position of the texture map using a preset initial color;

[0107] After determining the current texture position of the texture map, the color at the current texture position can be updated using a preset initial color, thus coloring the virtual model. The preset initial color can be selected by the user.

[0108] S14, render the virtual model at the first moment according to the updated texture map.

[0109] After the texture map is updated, the virtual model can be rendered based on the updated texture map at the first moment, thereby showing the user the real-time color display effect.

[0110] Step 202: Determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0111] After determining the current grid position of the touch operation, the current texture position of the virtual model's texture map corresponding to the current grid position can be further determined to determine the position in the texture map that needs to be colored.

[0112] In a practical implementation, the correspondence between the grid position of the virtual model's mesh in three-dimensional space and the texture position of the texture map can be preset. Thus, after determining the current grid position of the model mesh corresponding to the touch operation, the current texture position of the virtual model's texture map corresponding to the current grid position can be determined based on the preset correspondence.

[0113] In one embodiment of the present invention, the step of determining the current texture position of the texture map of the virtual model based on the current mesh position includes:

[0114] S21, determine whether the preset area mask overlaps with the current grid position;

[0115] Specifically, the virtual model may not need to be colored in all areas, but only in certain areas. For example, when applying makeup to the face of a 3D human model, if coloring the cheeks, one may not want the color to spread to areas outside the cheeks, such as the nose and lips, but only to the cheeks. At the same time, one should not want the colors of other areas to affect the current coloring.

[0116] In this situation, to avoid the negative impact of irrelevant areas on the current coloring process, a preset area mask can be used to mask the irrelevant areas. Therefore, after determining the current grid position of the touch operation on the virtual model's mesh, it is necessary to further determine whether the current grid position overlaps with the area mask, in order to determine whether the current grid position contains areas that do not want to be colored.

[0117] S22, if the preset region mask overlaps with the current grid position, the region in the current grid position that does not overlap with the region mask is taken as the target grid position;

[0118] If the area mask overlaps with the current grid position, it can be assumed that the current grid position contains areas that should not be colored. In this case, the uncovered area within the current grid position can be used as the target grid position to avoid coloring irrelevant areas.

[0119] S23, determine the current texture position of the texture map of the virtual model based on the target mesh position.

[0120] After determining the target mesh location, the current texture location of the virtual model's texture map can be determined based on the target mesh location, so as to determine the area that needs to be colored in the texture map.

[0121] As an example of the present invention Figure 3 This is a schematic diagram of a region masking in an embodiment of the present invention. If the current grid position 302 of the current grid position in the (n+1)th frame is covered by the region masking 301, then the area in the current grid position 302 that does not overlap with the region masking 301 can be taken as the target grid position. Subsequently, coloring is performed based on the target grid position to avoid coloring beyond the allowed coloring area.

[0122] Step 203: Collect the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map.

[0123] Specifically, in order to achieve the effect of color gradient, the color of the historical touch area where the touch operation is located at time n can be mixed with the current color of the current texture position, so that the target color determined at each time is based on the color of the historical touch area, thereby showing the effect of gradual color change.

[0124] Therefore, the rendered texture corresponding to the nth moment of the touch operation can be collected in advance. This allows for the recording of the target color from the previous moment, assuming the texture map's position change is discontinuous, by pre-collecting the color generated at the historical position of the touch operation on the texture map. Specifically, the rendered texture contains various information such as the size, dimensions, and color of the historical touch area. Thus, the color information of the touch operation within the historical touch area can be obtained from the rendered texture.

[0125] In one embodiment of the present invention, the step of acquiring the rendering texture corresponding to the touch operation at time n includes:

[0126] S31, use a virtual camera to capture the historical touch area corresponding to the touch operation at time n, and obtain the rendering texture corresponding to time n.

[0127] Specifically, 3D processing software such as Unity and Houdini can provide virtual camera functionality, which allows users to take pictures of virtual models and obtain the rendered texture at a certain moment.

[0128] Therefore, a virtual camera can be used to capture the historical touch area corresponding to the brush mask at time n, so as to obtain the rendering texture corresponding to time n. In the case that the position of the touch operation in the previous frame cannot be determined simply based on the grid position on the virtual model or the texture position on the texture map, the color information of the previous time, i.e. time n, can be obtained from the rendering texture for color mixing.

[0129] In one embodiment of the present invention, the step of acquiring the rendering texture corresponding to the touch operation at time n includes:

[0130] S41, determine whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n;

[0131] Specifically, the virtual model may not need to be colored in all areas, but only in some areas. Therefore, to avoid abnormal color mixing effects in the subsequent process of generating rendering textures due to the acquisition of locations unrelated to the coloring of the virtual model, it can be determined whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n during the acquisition of rendering textures, so as to determine whether color information of irrelevant locations may be acquired.

[0132] S42, if the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n, collect the area outside the overlap between the historical touch area and the area mask to obtain the rendered texture.

[0133] If the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n, then to avoid collecting color information from irrelevant locations, the area outside the area mask in the historical touch area can be sampled to obtain a rendered texture, allowing colors to be mixed correctly.

[0134] Step 204: Determine the first blending ratio corresponding to the historical touch area and the second blending ratio corresponding to the current texture position;

[0135] After obtaining the colors of the historical touch areas through texture rendering, the current texture position can be determined from the texture map, and the current color of the current texture position can be extracted. Then, the colors of the historical touch areas can be blended with the current color of the current texture position to determine the target color of the current texture position.

[0136] In the process of mixing the color of the historical touch area with the current color corresponding to the current texture position, the proportion of each color in the target color can be determined to determine the coloring effect at the current texture position. Therefore, a first mixing ratio corresponding to the historical touch area and a second mixing ratio corresponding to the current texture position can be determined separately. The sum of the first mixing ratio and the second mixing ratio can be 100%.

[0137] In practice, the values ​​of the first mixing ratio and the second blending ratio can be determined according to actual needs. For example, when the value of n+1 is small, to obtain a color closer to the preset initial color, the first mixing ratio can be set to be larger and the second blending ratio smaller. Conversely, when the value of n+1 is large, to obtain a color closer to the original color of the virtual model, the first mixing ratio can be set to be smaller and the second blending ratio larger. For another example, if the preset initial color is not significantly different from the original color of the virtual model, to emphasize the coloring effect, the first mixing ratio can be set to be larger and the second blending ratio smaller. Conversely, if the preset initial color is significantly different from the original color of the virtual model, to avoid an overly strong contrast between the added color and the virtual model, the first mixing ratio can be set to be smaller and the second blending ratio larger.

[0138] Step 205: According to the first mixing ratio and the second mixing ratio, the color of the historical touch area is mixed with the current color corresponding to the current texture position to obtain the target color of the current texture position;

[0139] After determining the first mixing ratio and the second mixing ratio, the color of the historical touch area can be mixed with the current color corresponding to the current texture position according to the first mixing ratio and the second mixing ratio to obtain the target color of the current texture position, so as to determine the color effect to be displayed at the current texture position.

[0140] In practice, the target color can be calculated using the following formula:

[0141] Target color = color of historical brush area × first blending ratio + color of current brush area × second blending ratio.

[0142] Step 206: Update the color at the current texture position of the texture map using the target color;

[0143] After determining the target color to be added to the current texture position, the color at the current texture position in the texture map is updated using the target color, thereby completing the coloring of the texture corresponding to the current mesh position in the virtual model.

[0144] Since the target color at the current texture position is determined based on the texture color corresponding to the historical touch area at time n (the previous touch operation) and the texture color corresponding to the current touch area at time n+1, the target color can be changed based on the colors of the historical touch areas, while referencing the current color at the current texture position. This allows for simplified color selection based on the colors of the historical touch areas, while also achieving a good blend with the current color of the virtual model, resulting in a natural color gradient effect.

[0145] Step 207: Render the virtual model at the (n+1)th time step according to the updated texture map.

[0146] After updating the color at the current texture position in the texture map, the updated texture map can be used to render the virtual model at the (n+1)th time step. This allows for the real-time display of the coloring effect of the virtual model during the process of coloring the virtual model through touch operation, thereby providing users with the function of real-time coloring and painting of virtual models in three-dimensional space.

[0147] As a specific example of the present invention Figure 4 This is a schematic diagram illustrating the coloring of a virtual model provided in an embodiment of the present invention.

[0148] like Figure 4 As shown in (a), for the first moment, in response to a touch operation applied to the virtual model, the current grid position of the touch operation on the model mesh of the virtual model at the first moment can be obtained to determine the position of the virtual model that needs to be colored. Subsequently, the current texture position of the texture map of the virtual model is determined according to the current grid position, and the color at the current texture position of the texture map is updated with a preset initial color to achieve the initial coloring of the virtual model. After rendering the virtual model at the first moment according to the updated texture map, a virtual camera can be used to capture the historical touch area corresponding to the touch operation at the first moment to obtain the rendered texture corresponding to the first moment.

[0149] like Figure 4As shown in (b), for the second moment, the response to the touch operation acting on the virtual model can be determined, and the current grid position of the touch operation in the model mesh of the virtual model at the current second moment can be obtained. After determining the current texture position of the texture map of the virtual model based on the current grid position, the rendering texture corresponding to the touch operation at the first moment can be collected to obtain the color information of the touch operation in the historical touch area in the rendering texture. The color of the historical touch area is mixed with the current color of the current texture position to obtain the target color of the current texture position. Then, the color of the texture map at the current texture position is updated with the target color, and the virtual model at the second moment is rendered according to the updated texture map, so that the coloring effect can be displayed in the model in real time. The coloring effect is as follows. Figure 4 As shown in (c). Subsequently, a virtual camera can be used to capture the historical touch area corresponding to the touch operation at the second moment to obtain the rendered texture corresponding to the second moment.

[0150] like Figure 4 As shown in (d), for the third moment, the touch operation acting on the virtual model can be determined, and the current grid position of the touch operation on the model mesh of the virtual model at the current third moment can be obtained. After determining the current texture position of the texture map of the virtual model based on the current grid position, the rendered texture corresponding to the touch operation at the second moment can be collected to obtain the color information of the touch operation in the historical touch area in the rendered texture. The color of the historical touch area is mixed with the current color of the current texture position to obtain the target color of the current texture position. Then, the color of the texture map at the current texture position is updated with the target color, and the virtual model at the third moment is rendered based on the updated texture map, so that the coloring effect can be displayed in the model in real time. The coloring effect is as follows. Figure 4 As shown in (e), this allows for the application of color gradients to virtual models.

[0151] The data processing method of this invention responds to a touch operation applied to a virtual model, obtaining the current grid position of the touch operation on the model mesh of the virtual model at the (n+1)th time, where n≥1; determining the current texture position of the texture map of the virtual model based on the current grid position; acquiring the rendering texture corresponding to the touch operation at the nth time, obtaining the color information of the touch operation in the historical touch area in the rendering texture, the rendering texture being a texture generated based on the color of the touch operation at the historical position of the texture map; determining a first blending ratio corresponding to the historical touch area and a second blending ratio corresponding to the current texture position; blending the color of the historical touch area with the current color corresponding to the current texture position according to the first blending ratio and the second blending ratio to obtain the target color of the current texture position; updating the color at the current texture position of the texture map using the target color; and rendering the virtual model at the (n+1)th time based on the updated texture map, thereby achieving a color gradient painting effect on the virtual model in three-dimensional space.

[0152] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0153] Reference Figure 5 The diagram shows a structural block diagram of a data processing device provided in an embodiment of the present invention, which may specifically include the following modules:

[0154] The model position determination module 501 is used to respond to a touch operation applied to the virtual model and obtain the current grid position of the touch operation in the model grid of the virtual model at the current (n+1)th time, wherein n≥1;

[0155] The texture position determination module 502 is used to determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0156] The rendering texture acquisition module 503 is used to acquire the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map.

[0157] The mixing module 504 is used to mix the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position;

[0158] Color update module 505 is used to update the color at the current texture position of the texture map using the target color;

[0159] The model update module 506 is used to render the virtual model at the (n+1)th time step based on the updated texture map.

[0160] Optionally, the texture location determination module includes:

[0161] The first overlap determination submodule is used to determine whether a preset area mask overlaps with the current grid position;

[0162] The target grid position determination submodule is used to determine the target grid position if a preset region mask overlaps with the current grid position, and the region outside the region mask in the current grid position is taken as the target grid position.

[0163] The texture position determination submodule is used to determine the current texture position of the texture map of the virtual model based on the target mesh position.

[0164] Optionally, the rendering texture acquisition module includes:

[0165] The first rendering texture acquisition submodule is used to capture the historical touch area corresponding to the touch operation at time n using a virtual camera, and obtain the rendering texture corresponding to time n.

[0166] Optionally, the rendering texture acquisition module includes:

[0167] The second overlap determination submodule is used to determine whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n.

[0168] The second rendering texture acquisition submodule is used to acquire the area outside the overlap between the preset area mask and the historical touch area corresponding to the touch operation at time n, and obtain the rendering texture.

[0169] Optionally, the device further includes:

[0170] The first-moment model position determination module is used to, in response to a touch operation applied to the virtual model at the first moment, obtain the current grid position of the touch operation on the model grid of the virtual model at the first moment.

[0171] The first-moment texture position determination module is used to determine the current texture position of the texture map of the virtual model based on the current mesh position;

[0172] An initial color update module is used to update the color at the current texture position of the texture map using a preset initial color;

[0173] The first-moment rendering module is used to render the virtual model at the first moment based on the updated texture map.

[0174] Optionally, the hybrid module includes:

[0175] The ratio determination submodule is used to determine the first mixing ratio corresponding to the historical touch area and the second mixing ratio corresponding to the current texture position;

[0176] The mixing submodule is used to mix the color of the historical touch area with the current color corresponding to the current texture position according to the first mixing ratio and the second mixing ratio to obtain the target color of the current texture position.

[0177] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0178] In addition, embodiments of the present invention also provide an electronic device, such as... Figure 6 As shown, it includes a processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.

[0179] Memory 603 is used to store computer programs;

[0180] When processor 601 executes a program stored in memory 603, it performs the following steps:

[0181] In response to a touch operation applied to a virtual model, the current grid position of the touch operation in the model grid of the virtual model is obtained at the current (n+1)th time, where n≥1;

[0182] The current texture position of the texture map of the virtual model is determined based on the current mesh position;

[0183] Collect the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map.

[0184] The color of the historical touch area is mixed with the current color of the current texture position to obtain the target color of the current texture position;

[0185] Update the color at the current texture position of the texture map using the target color;

[0186] The virtual model at time n+1 is rendered based on the updated texture map.

[0187] Optionally, the step of determining the current texture position of the texture map of the virtual model based on the current mesh position includes:

[0188] Determine whether the preset area mask overlaps with the current grid position;

[0189] If the preset region mask overlaps with the current grid position, the region in the current grid position that does not overlap with the region mask is taken as the target grid position;

[0190] The current texture position of the texture map of the virtual model is determined based on the target mesh position.

[0191] Optionally, the step of acquiring the rendering texture corresponding to the touch operation at time n includes:

[0192] A virtual camera is used to capture the historical touch area corresponding to the touch operation at time n, and the rendered texture corresponding to time n is obtained.

[0193] Optionally, the step of acquiring the rendering texture corresponding to the touch operation at time n includes:

[0194] Determine whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n;

[0195] If the preset region mask overlaps with the historical touch area corresponding to the touch operation at time n, the area outside the overlap between the historical touch area and the region mask is collected to obtain the rendered texture.

[0196] Optionally, the method further includes:

[0197] For the first moment, in response to a touch operation applied to the virtual model, the current grid position of the touch operation on the model grid of the virtual model is obtained at the first moment;

[0198] The current texture position of the texture map of the virtual model is determined based on the current mesh position;

[0199] The color at the current texture position of the texture map is updated by using a preset initial color;

[0200] The virtual model at the first moment is rendered based on the updated texture map.

[0201] Optionally, the step of mixing the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position includes:

[0202] Determine the first blending ratio corresponding to the historical touch area and the second blending ratio corresponding to the current texture position;

[0203] Based on the first mixing ratio and the second mixing ratio, the color of the historical touch area is mixed with the current color corresponding to the current texture position to obtain the target color of the current texture position.

[0204] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0205] The communication interface is used for communication between the aforementioned terminal and other devices.

[0206] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0207] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0208] like Figure 7 As shown, in another embodiment of the present invention, a computer-readable storage medium 701 is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the data processing method described in the above embodiments.

[0209] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the data processing method described in the above embodiments.

[0210] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0211] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0212] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0213] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A data processing method, characterized in that, include: In response to a touch operation applied to a virtual model, the current grid position of the touch operation in the model grid of the virtual model is obtained at the current (n+1)th time, where n≥1; The current texture position of the texture map of the virtual model is determined based on the current mesh position; Collect the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map. The color of the historical touch area is mixed with the current color of the current texture position to obtain the target color of the current texture position; Update the color at the current texture position of the texture map using the target color; The virtual model at time n+1 is rendered based on the updated texture map.

2. The method according to claim 1, characterized in that, The step of determining the current texture position of the texture map of the virtual model based on the current mesh position includes: Determine whether the preset area mask overlaps with the current grid position; If the preset region mask overlaps with the current grid position, the region in the current grid position that does not overlap with the region mask is taken as the target grid position; The current texture position of the texture map of the virtual model is determined based on the target mesh position.

3. The method according to claim 1, characterized in that, The step of acquiring the rendering texture corresponding to the touch operation at time n includes: A virtual camera is used to capture the historical touch area corresponding to the touch operation at time n, and the rendering texture corresponding to time n is obtained.

4. The method according to claim 1 or 3, characterized in that, The step of acquiring the rendering texture corresponding to the touch operation at time n includes: Determine whether the preset area mask overlaps with the historical touch area corresponding to the touch operation at time n; If the preset region mask overlaps with the historical touch area corresponding to the touch operation at time n, the area outside the overlap between the historical touch area and the region mask is collected to obtain the rendered texture.

5. The method according to claim 1, characterized in that, The method further includes: For the first moment, in response to a touch operation applied to the virtual model, the current grid position of the touch operation on the model grid of the virtual model is obtained at the first moment; The current texture position of the texture map of the virtual model is determined based on the current mesh position; The color at the current texture position of the texture map is updated by using a preset initial color; The virtual model at the first moment is rendered based on the updated texture map.

6. The method according to claim 1, characterized in that, The step of mixing the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position includes: Determine the first blending ratio corresponding to the historical touch area and the second blending ratio corresponding to the current texture position; Based on the first mixing ratio and the second mixing ratio, the color of the historical touch area is mixed with the current color corresponding to the current texture position to obtain the target color of the current texture position.

7. A data processing apparatus, characterized in that, include: The model position determination module is used to respond to a touch operation applied to the virtual model and obtain the current grid position of the touch operation in the model grid of the virtual model at the current (n+1)th time, where n≥1; The texture position determination module is used to determine the current texture position of the texture map of the virtual model based on the current mesh position; The rendering texture acquisition module is used to acquire the rendering texture corresponding to the touch operation at time n, and obtain the color information of the touch operation in the historical touch area in the rendering texture. The rendering texture is a texture generated based on the color of the touch operation at the historical position of the texture map. A mixing module is used to mix the color of the historical touch area with the current color of the current texture position to obtain the target color of the current texture position; The color update module is used to update the color at the current texture position of the texture map using the target color; The model update module is used to render the virtual model at the (n+1)th time step based on the updated texture map.

8. The apparatus according to claim 7, characterized in that, The texture location determination module includes: The first overlap determination submodule is used to determine whether a preset area mask overlaps with the current grid position; The target grid position determination submodule is used to determine the target grid position if a preset region mask overlaps with the current grid position, and the region outside the region mask in the current grid position is taken as the target grid position. The texture position determination submodule is used to determine the current texture position of the texture map of the virtual model based on the target mesh position.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-6.

10. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Makeup assistance device, makeup assistance method, and makeup assistance program

    CN104797165A

  • Method for generating color, terminal thereof, and system thereof

    KR1020150088105A