Texture processing method and device of virtual model, computer device and storage medium

By adjusting the texture processing method of the virtual model and combining mask mapping and detail normal mapping, the problem of dull texture display in the virtual embroidery model was solved, improving realism and user experience.

CN115393495BActive Publication Date: 2026-07-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211091287.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-07
Publication Date
2026-07-14
Estimated Expiration
2042-09-07

AI Technical Summary

Technical Problem

In existing virtual embroidery models rendered with existing technology, the stitches in the same material area have the same direction, resulting in a dull display effect, low realism, and poor visual experience for users.

Method used

By obtaining the mask brightness value of the non-masked area of ​​the mask map, converting it into texture coordinate rotation information, adjusting the pixel information of the base normal map, and combining it with the detail normal map for sampling and fusion, and performing lighting and shadow rendering processing, we can ensure that the texture display effect of different texture areas is different.

Benefits of technology

It improves the realism of virtual embroidery models and enhances the user's visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115393495B_ABST
    Figure CN115393495B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a virtual model texture processing method and device, computer equipment and a storage medium. The method comprises the following steps: obtaining a mask map corresponding to a basic normal map of a to-be-rendered detail texture; converting a mask brightness value of each pixel point in the mask map into texture coordinate rotation information; obtaining a rotated texture coordinate of each pixel point according to the texture coordinate rotation information corresponding to each pixel point; sampling a preset detail normal map according to the rotated texture coordinate to obtain sampling detail normal information; fusing the sampling normal information and first normal information carried by the basic normal map to obtain second normal information; and performing light and shadow rendering processing on the basic normal map based on the mask brightness value in the mask map and the second normal information to obtain a rendered detail texture. The embodiments of the present application can make the texture display effect in different texture regions in the basic normal map different, improve the reality of rendering a virtual embroidery model, and improve the user visual perception.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to a texture processing method, apparatus, computer device, and storage medium for a virtual model. Background Technology

[0002] With the continuous development of computer communication technology and the widespread use of terminals such as smartphones, tablets, and laptops, terminals are becoming increasingly diversified and personalized, becoming indispensable in people's lives and work. To satisfy people's pursuit of spiritual enrichment, entertainment games that can be played on these terminals have emerged. For example, games developed based on client or server architecture, such as Multiplayer Online Battle Arena (MOBA) and Massive Multiplayer Online (MMO), are popular due to their high smoothness, good controls, and real-time combat. With the booming development of online games, people's demands for the realism of game scenes are increasing.

[0003] In computer animation production for games, techniques related to detail normals can be used to add textures of various materials to virtual models, such as stitch information for embroidery. However, because the stitches in the same material area of ​​the virtual embroidery model rendered by existing technology are exactly the same, the display effect is rigid and does not conform to the visual experience of real embroidery to users, resulting in low realism of the rendered virtual embroidery model and poor visual experience for users. Summary of the Invention

[0004] This application provides a texture processing method, apparatus, computer device, and storage medium for virtual models. It can adjust the pixel information of the base normal map based on the mask map and detail normal map of non-masked areas including multiple masking brightness values, so that the texture display effect in different texture areas of the base normal map is different, thereby improving the realism of rendering virtual embroidery models and enhancing the user's visual experience.

[0005] This application provides a texture processing method for a virtual model, the method comprising:

[0006] Obtain the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is the detail texture set for the target virtual model.

[0007] Obtain the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information. Different mask brightness values ​​correspond to different texture coordinate transformation information.

[0008] The texture coordinates of each pixel are transformed and calculated based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel.

[0009] Based on the rotated texture coordinates, the preset detail normal map is sampled to obtain sampled detail normal information;

[0010] The sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information;

[0011] Based on the mask brightness value in the mask map and the second normal information, the base normal map is subjected to lighting and shadow rendering to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

[0012] Accordingly, embodiments of this application also provide a texture processing apparatus for a virtual model, the texture processing apparatus for the virtual model comprising:

[0013] The first acquisition unit is used to acquire the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is a detail texture set for the target virtual model.

[0014] The second acquisition unit is used to acquire the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information, wherein different mask brightness values ​​correspond to different texture coordinate transformation information.

[0015] The calculation unit is used to perform transformation calculation on the texture coordinates of the pixel based on the texture coordinate rotation information corresponding to each pixel, so as to obtain the rotated texture coordinates of each pixel.

[0016] The sampling unit is used to sample the preset detail normal map according to the rotated texture coordinates to obtain sampled detail normal information;

[0017] The fusion unit is used to fuse the sampled normal information with the first normal information carried by the base normal map to obtain the second normal information;

[0018] The rendering unit is used to perform lighting and shadow rendering processing on the base normal map based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

[0019] Accordingly, this application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of any one of the texture processing methods for a virtual model.

[0020] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any one of the texture processing methods for a virtual model.

[0021] This application provides a texture processing method, apparatus, computer device, and storage medium for a virtual model. The method involves obtaining a mask map corresponding to the base normal map of a detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not all equal. The detail texture to be rendered is a detail texture set for a target virtual model. Then, the mask brightness value of each pixel in the mask map is obtained, and each mask brightness value is converted into texture coordinate rotation information. The texture coordinate transformation information corresponding to different mask brightness values... The information is different; then, the texture coordinates of each pixel are transformed and calculated according to the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel; then, according to the rotated texture coordinates, the preset detail normal map is sampled to obtain sampled detail normal information; then, the sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information; finally, the base normal map is subjected to lighting and shadow rendering processing based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model. In this embodiment of the application, the pixel information of the base normal map can be adjusted according to the mask map and detail normal map including multiple non-masked areas with different mask brightness values, so that the texture display effect in different texture areas of the base normal map is different, which improves the realism of the rendered virtual embroidery model and enhances the user's visual experience. Attached Figure Description

[0022] 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.

[0023] Figure 1 A scene diagram illustrating the texture processing system for the virtual model provided in this application embodiment.

[0024] Figure 2 This is a schematic flowchart of a texture processing method for a virtual model provided in an embodiment of this application.

[0025] Figure 3 This is a schematic diagram illustrating an application of the masking texture provided in an embodiment of this application.

[0026] Figure 4 This is a scene diagram illustrating a texture processing method for a virtual model provided in an embodiment of this application.

[0027] Figure 5 This is a schematic diagram of a texture processing device for a virtual model provided in an embodiment of this application.

[0028] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0029] 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 a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0030] This application provides a method, apparatus, computer device, and storage medium for texture processing of virtual models. Specifically, the texture processing method for virtual models in 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, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client. 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, CDN, and big data and artificial intelligence platforms.

[0031] For example, when the texture processing method of the virtual model runs on a terminal, the terminal device stores a game application and uses it to render the virtual scene in the game screen. The terminal device is used to interact with the user through a graphical user interface, such as downloading, installing, and running the game application. The terminal device can provide the graphical user interface to the user in various ways, such as rendering it on the terminal device's display screen or presenting the graphical user interface through holographic projection. For example, the terminal device can include a touch screen and a processor. The touch screen is used to present the graphical user interface and receive operation commands generated by the user interacting with the graphical user interface, which includes game screens. The processor is used to run the game, generate the graphical user interface, respond to operation commands, and control the display of the graphical user interface on the touch screen.

[0032] For example, when the texture processing method of the virtual model runs on a server, it can be considered cloud gaming. Cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the main body running the game application and the main body displaying the game screen are separated. The storage and execution of the texture processing method of the virtual model are completed on the cloud gaming server. The game screen display is completed on the cloud gaming client. The cloud gaming client is mainly used for receiving and sending game data and displaying game screens. For example, the cloud gaming client can be a display device with data transmission capabilities close to the user, such as a mobile terminal, television, computer, PDA, personal digital assistant, etc., but the terminal device for processing game data is the cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the cloud gaming client through the network, and finally, the cloud gaming client decodes and outputs the game screen.

[0033] Please see Figure 1 , Figure 1 This is a schematic diagram of a virtual model texture processing system provided in an embodiment of this application. The system may include at least one terminal, at least one server, at least one database, and a network. A user's terminal can connect to different game servers via the network. The terminal is any device with computing hardware capable of supporting and executing software products corresponding to the game. Furthermore, when the system includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to each other through different networks and servers. The network can be a wireless network or a wired network, such as a wireless local area network (WLAN), local area network (LAN), cellular network, 2G network, 3G network, 4G network, 5G network, etc. Additionally, different terminals can also connect to other terminals or servers using their own Bluetooth networks or hotspot networks. For example, multiple users can connect online through different terminals via appropriate networks and synchronize with each other to support multiplayer games. Furthermore, the system may include multiple databases coupled to different servers, and can continuously store game environment-related information in the databases while different users are playing multiplayer games online.

[0034] It should be noted that, Figure 1The schematic diagram of the virtual model texture processing system shown is merely an example. The virtual model texture processing system and scene described in this application embodiment are for the purpose of more clearly illustrating the technical solutions of this application embodiment and do not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.

[0035] To address the aforementioned problems, this application provides a texture processing method, apparatus, computer device, and storage medium for virtual models, which can improve the realism of virtual models displayed in games. These will be described in detail below. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.

[0036] Please see Figure 2 , Figure 2 This is a flowchart illustrating a texture processing method for a virtual model provided in an embodiment of this application. The specific process of the texture processing method for the virtual model can be shown in steps 101 to 106 below:

[0037] 101. Obtain the mask map corresponding to the base normal map of the detail texture to be rendered, wherein the base normal map includes multiple texture regions of the detail texture to be rendered, the non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal, and the detail texture to be rendered is a detail texture set for the target virtual model.

[0038] In order to obtain a mask map that includes multiple non-masked areas with different mask brightness, the method for the step "obtaining the mask map corresponding to the base normal map of the detail texture to be rendered" may include:

[0039] A texture to be processed is obtained, and the texture to be processed is processed based on the texture regions of multiple detail textures to be rendered in the base normal map to obtain a processed texture, wherein the processed texture includes multiple regions to be processed, and the regions to be processed correspond one-to-one with the texture regions.

[0040] A masking brightness value is set for each of the multiple areas to be processed to obtain multiple unmasked areas, wherein the masking brightness values ​​of the unmasked areas are not completely equal.

[0041] A specified mask brightness value is set for other areas besides the multiple areas to be processed to obtain a mask texture, wherein the specified mask brightness value is the mask brightness value that makes the other areas black.

[0042] For example, please see Figure 3Obtain a mask map that is identical to the texture regions of multiple detail textures to be rendered in the base normal map. Each non-masked region in the mask map is set with a non-zero and different mask brightness value. Furthermore, the mask brightness of other masked regions in the mask map is set to 0 so that all regions except the masked regions are displayed as black.

[0043] 102. Obtain the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information, wherein the texture coordinate transformation information corresponding to different mask brightness values ​​is different.

[0044] In one specific embodiment, the method for the step "obtaining the mask brightness value of each pixel in the mask texture and converting each mask brightness value into texture coordinate rotation information" may include:

[0045] The mask brightness value of each pixel in the mask texture is processed based on the preset angle difference value and the preset angle offset value, and each mask brightness value is converted into texture coordinate rotation information.

[0046] Furthermore, the step "processing the mask brightness value of each pixel in the mask texture based on the preset angle difference value and the preset angle offset value, and converting each mask brightness value into texture coordinate rotation information" can include:

[0047] Obtain the product between the mask brightness value of the pixel and the preset angle difference value;

[0048] The sum of the product and the preset angle offset value is obtained as the provisional rotation value of the pixel.

[0049] The texture coordinate rotation information of the pixel is generated based on the provisional rotation value of the pixel and the preset rotation matrix.

[0050] For example, mask brightness values ​​can be mapped to a UV rotation angle using a calculation formula; this rotation angle is the provisional rotation value. A computer device can convert each mask brightness value into a provisional rotation value according to the rotation value calculation formula, as shown below:

[0051] Angle=MaskBrightness×AngleDiff+AngleBias

[0052] MaskBrightness is the brightness value of the mask for each pixel, AngleDiff is the preset angle difference value, and AngleBias is the preset angle offset value. Both the preset angle difference and preset angle offset values ​​are values ​​that artists can flexibly set according to actual design needs. The preset angle difference value is used to adjust the size of the angle difference between different gray levels, while the preset angle offset value is used to add an overall angle deflection to all rendered areas. Therefore, artists can use these two values ​​to flexibly set the final deflection effect of the detail normal map.

[0053] To obtain the texture coordinate rotation information of each pixel, the step "generating the texture coordinate rotation information of the pixel based on the provisional rotation value and preset rotation matrix" may include:

[0054] The preset rotation matrix is ​​adjusted based on the provisional selection value of the pixel to obtain the target rotation matrix, and the target rotation matrix is ​​used as the texture coordinate rotation information of the pixel.

[0055] For example, a computer device can calculate the texture coordinate rotation information corresponding to the texture coordinates of each pixel based on a provisional rotation value corresponding to each pixel. Specifically, a preset rotation matrix can be adjusted using each provisional rotation value to obtain a target rotation matrix. Subsequently, the target rotation matrix corresponding to each pixel can be used to process the texture coordinates corresponding to each pixel. Specifically, the preset rotation matrix can be as follows:

[0056]

[0057] Here, RotationMatrix is ​​the preset rotation matrix, and Angle is the provisional rotation value corresponding to each pixel. Substituting the provisional rotation value corresponding to each pixel into the preset rotation matrix will yield the target rotation matrix corresponding to each pixel.

[0058] 103. Based on the texture coordinate rotation information corresponding to each pixel, the texture coordinates of the pixel are transformed and calculated to obtain the rotated texture coordinates of each pixel.

[0059] Furthermore, the method for the step "transforming and calculating the texture coordinates of the pixel based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel" may include:

[0060] The texture coordinates of the pixel are transformed and calculated based on the target rotation matrix of the pixel to obtain the rotated texture coordinates of the pixel.

[0061] Specifically, the computer device can perform transformation calculations on the texture coordinates of each pixel based on the texture coordinate transformation formula, the target rotation matrix, and a preset two-dimensional vector to obtain the rotated texture coordinates of each pixel. The specific texture coordinate transformation formula is as follows:

[0062] UVRotation=transform(RotationMatrix,UV*FiberDensity)

[0063] Here, UVRotation represents the texture coordinates after rotation, RotationMatrix is ​​the target rotation matrix corresponding to each pixel, UV represents the texture coordinates of each pixel, and FiberDensity is a preset 2D vector. This 2D vector is a 2D vector that artists can flexibly set. Its two components are used to set the horizontal and vertical tiling density of the detail normal map after rotation, which can be used to adjust the length and density of the stitch texture.

[0064] For example, the texture coordinate rotation information corresponding to each pixel can be a two-dimensional spatial rotation matrix corresponding to each pixel. After obtaining the two-dimensional spatial rotation matrix corresponding to the pixel, the texture coordinates of the pixel can be transformed and calculated based on the two-dimensional spatial rotation matrix corresponding to the pixel and the two-dimensional vector preset by the artist, so as to obtain the texture coordinates of the pixel after rotation. The two-dimensional vector includes two components, which can be used to set the horizontal and vertical tiling density of the detail normal map after rotation, that is, it can be used to adjust the length and density of the stitch texture.

[0065] 104. Based on the rotated texture coordinates, sample the preset detail normal map to obtain sampled detail normal information.

[0066] 105. The sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information.

[0067] 106. Based on the mask brightness value in the mask map and the second normal information, perform light and shadow rendering processing on the basic normal map to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

[0068] To highlight the texture corresponding to the non-masked areas, before the step of "performing lighting and shadow rendering on the base normal map based on the mask brightness value in the mask map and the second normal information", the method may include:

[0069] The display information for each pixel is generated based on the mask brightness value of each pixel in the mask texture;

[0070] The basic normal map is subjected to lighting and shadow rendering based on the display information of each pixel and the second normal information to obtain the rendered detail texture.

[0071] Specifically, the method for the step "generating display information for each pixel based on the mask brightness value of each pixel in the mask texture" may include:

[0072] Determine the relationship between the mask brightness value of each pixel and the preset brightness reference value;

[0073] If the mask brightness value of the pixel is greater than the preset brightness reference value, then the pixel intensity of the pixel is set to the first preset value;

[0074] If the mask brightness value of the pixel is less than the preset brightness reference value, then the pixel intensity of the pixel is set to a second preset value, wherein the first preset value is greater than the second preset value.

[0075] For example, after obtaining the mask brightness value of each pixel in the mask map, the distribution intensity set for the detail normal map can be calculated first. This involves inputting the mask brightness value of each pixel into the distribution intensity function for processing, thus obtaining the display information of each pixel, i.e., the distribution intensity of each pixel. This distribution intensity function is shown below:

[0076] Mask=step(0.0001,MaskBrightness),

[0077] Here, Mask represents the distribution intensity, and MaskBrightness is the mask brightness value for each pixel. Specifically, this distribution intensity function sets the pixel intensity of pixels with a mask brightness value greater than 0.0001 to 1, and sets the pixel intensity of other pixels with a mask brightness value less than 0.0001 to 0.

[0078] Furthermore, the computer device can obtain the normal information that is ultimately distributed only within the non-masked area based on a preset function, which is shown below:

[0079] NormalFinal=lerp(Normal,NormalBlend,Mask)

[0080] Among them, NormalFinal is the second normal information for each pixel, Normal is the first normal information for each pixel, NormalBlend is the sampling detail normal information for each pixel, and Mask is the distribution intensity for each pixel.

[0081] To further illustrate the texture processing method for virtual models provided in this application embodiment, the following will take the application of the texture processing method for virtual models in a specific implementation scenario as an example. The specific application scenario is as follows.

[0082] (1) The computer device can acquire a mask map that is the same as the texture regions of multiple detail textures to be rendered in the base normal map. Each non-masked region in the mask map is set with a non-zero and different mask brightness value. Furthermore, the mask brightness of other non-masked regions of the mask map is set to 0 so that all other regions except the masked regions are displayed as black.

[0083] (2) After obtaining the mask brightness value of each pixel in the mask texture, the distribution intensity set for the detail normal map can be calculated first. That is, the mask brightness value of each pixel is input into the distribution intensity function for processing to obtain the display information of each pixel, that is, the distribution intensity of each pixel. The distribution intensity function is as follows:

[0084] Mask=step(0.0001,MaskBrightness),

[0085] Here, Mask represents the distribution intensity, and MaskBrightness is the mask brightness value for each pixel. Specifically, this distribution intensity function sets the pixel intensity of pixels with a mask brightness value greater than 0.0001 to 1, and sets the pixel intensity of other pixels with a mask brightness value less than 0.0001 to 0.

[0086] Furthermore, the computer device can convert each mask brightness value into a provisional rotation value according to the rotation value calculation formula, which is shown below:

[0087] Angle=MaskBrightness×AngleDiff+AngleBias

[0088] MaskBrightness is the brightness value of the mask for each pixel, AngleDiff is the preset angle difference value, and AngleBias is the preset angle offset value. Both the preset angle difference and preset angle offset values ​​are values ​​that artists can flexibly set according to actual design needs. The preset angle difference value is used to adjust the size of the angle difference between different gray levels, while the preset angle offset value is used to add an overall angle deflection to all rendered areas. Therefore, artists can use these two values ​​to flexibly set the final deflection effect of the detail normal map.

[0089] (3) The computer device can calculate the texture coordinate rotation information corresponding to the texture coordinates of each pixel based on the provisional rotation value corresponding to each pixel. Specifically, the preset rotation matrix can be adjusted using each provisional rotation value to obtain the target rotation matrix. Subsequently, the texture coordinates corresponding to each pixel can be processed using the target rotation matrix corresponding to each pixel. Specifically, the preset rotation matrix can be as follows:

[0090]

[0091] Here, RotationMatrix is ​​the preset rotation matrix, and Angle is the provisional rotation value corresponding to each pixel. Substituting the provisional rotation value corresponding to each pixel into the preset rotation matrix will yield the target rotation matrix corresponding to each pixel.

[0092] (4) The computer device can perform transformation calculations on the texture coordinates of each pixel based on the texture coordinate transformation formula, the target rotation matrix, and the preset two-dimensional vector to obtain the rotated texture coordinates of each pixel. Specifically, the texture coordinate transformation formula is as follows:

[0093] UVRotation=transform(RotationMatrix,UV*FiberDensity)

[0094] Here, UVRotation represents the texture coordinates after rotation, RotationMatrix is ​​the target rotation matrix corresponding to each pixel, UV represents the texture coordinates of each pixel, and FiberDensity is a preset 2D vector. This 2D vector is a 2D vector that artists can flexibly set. Its two components are used to set the horizontal and vertical tiling density of the detail normal map after rotation, which can be used to adjust the length and density of the stitch texture.

[0095] (5) Based on the rotated texture coordinates, sample the preset detail normal map to obtain sampled detail normal information. Then, fuse the sampled normal information with the first normal information carried by the base normal map to obtain the second normal information. Specifically, the computer device can obtain the normal information that is ultimately distributed only within the non-masked area according to a preset function, which is shown below:

[0096] NormalFinal=lerp(Normal,NormalBlend,Mask)

[0097] Among them, NormalFinal is the second normal information for each pixel, Normal is the first normal information for each pixel, NormalBlend is the sampling detail normal information for each pixel, and Mask is the distribution intensity for each pixel.

[0098] (6) After obtaining the second normal information for each pixel, the computer device performs lighting and shadow rendering processing on the basic normal map to obtain the rendered detail texture. For details, please refer to [link to documentation]. Figure 4 The above steps can be used to adjust an initial embroidery model, in which each embroidery area has the same stitch texture direction as the traditional process, into a target embroidery model where each embroidery area has a different stitch texture direction.

[0099] In summary, this application provides a texture processing method, apparatus, computer device, and storage medium for a virtual model. The method involves obtaining a mask map corresponding to the base normal map of a detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not all equal. The detail texture to be rendered is a detail texture set for a target virtual model. Then, the mask brightness value of each pixel in the mask map is obtained, and each mask brightness value is converted into texture coordinate rotation information. The texture coordinates corresponding to different mask brightness values ​​change... The information is different; then, the texture coordinates of each pixel are transformed and calculated according to the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel; then, according to the rotated texture coordinates, the preset detail normal map is sampled to obtain sampled detail normal information; then, the sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information; finally, the base normal map is subjected to lighting and shadow rendering processing based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model. In this embodiment of the application, the pixel information of the base normal map can be adjusted according to the mask map and detail normal map including multiple non-masked areas with different mask brightness values, so that the texture display effect in different texture areas of the base normal map is different, which improves the realism of the rendered virtual embroidery model and enhances the user's visual experience.

[0100] To facilitate better implementation of the texture processing method for the virtual model provided in this application, this application also provides a texture processing apparatus based on the aforementioned virtual model. The meanings of the terms used are the same as in the texture processing method for the virtual model described above, and specific implementation details can be found in the descriptions within the method embodiments.

[0101] Please see Figure 5 , Figure 5 This application provides a schematic diagram of the structure of a texture processing device for a virtual model, which includes:

[0102] The first acquisition unit 201 is used to acquire the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is a detail texture set for the target virtual model.

[0103] The second acquisition unit 202 is used to acquire the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information, wherein the texture coordinate transformation information corresponding to different mask brightness values ​​is different.

[0104] The calculation unit 203 is used to perform transformation calculation on the texture coordinates of the pixel according to the texture coordinate rotation information corresponding to each pixel, so as to obtain the rotated texture coordinates of each pixel;

[0105] The sampling unit 204 is used to sample the preset detail normal map according to the rotated texture coordinates to obtain sampled detail normal information;

[0106] The fusion unit 205 is used to fuse the sampled normal information with the first normal information carried by the base normal map to obtain the second normal information;

[0107] The rendering unit 206 is used to perform light and shadow rendering processing on the basic normal map based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

[0108] In some embodiments, the texture processing apparatus for the virtual model includes:

[0109] The first acquisition subunit is used to acquire the texture to be processed and process the texture to be processed based on the texture regions of multiple detail textures to be rendered in the base normal map to obtain the processed texture to be processed. The processed texture to be processed includes multiple regions to be processed, and the regions to be processed correspond one-to-one with the texture regions.

[0110] The first setting subunit is used to set a mask brightness value for each of the multiple areas to be processed, so as to obtain multiple unmasked areas, wherein the mask brightness values ​​of the unmasked areas are not completely equal.

[0111] The second setting subunit is used to set a specified mask brightness value for other areas besides the multiple areas to be processed, so as to obtain a mask texture, wherein the specified mask brightness value is a mask brightness value that makes the other areas black.

[0112] In some embodiments, the texture processing apparatus for the virtual model includes:

[0113] The first generation subunit is used to generate display information for each pixel based on the mask brightness value of each pixel in the mask texture;

[0114] The first processing subunit is used to perform lighting and shadow rendering processing on the basic normal map based on the display information of each pixel and the second normal information to obtain the rendered detail texture.

[0115] In some embodiments, the texture processing apparatus for the virtual model includes:

[0116] Determine the sub-unit, which is used to determine the relationship between the mask brightness value of each pixel and the preset brightness reference value;

[0117] The third setting subunit is used to set the pixel intensity of the pixel to a first preset value if the mask brightness value of the pixel is greater than the preset brightness reference value.

[0118] The fourth setting subunit is used to set the pixel intensity of the pixel to a second preset value if the mask brightness value of the pixel is less than the preset brightness reference value, wherein the first preset value is greater than the second preset value.

[0119] In some embodiments, the texture processing apparatus for the virtual model includes:

[0120] The second processing subunit is used to process the mask brightness value of each pixel in the mask texture based on the preset angle difference value and the preset angle offset value, and convert each mask brightness value into texture coordinate rotation information.

[0121] In some embodiments, the texture processing apparatus for the virtual model includes:

[0122] The second acquisition subunit is used to acquire the product between the mask brightness value of the pixel and the preset angle difference value;

[0123] The third acquisition subunit is used to acquire the sum of the product and the preset angle offset value, as a provisional rotation value of the pixel.

[0124] The second generation subunit is used to generate texture coordinate rotation information of the pixel based on the provisional rotation value of the pixel and the preset rotation matrix.

[0125] In some embodiments, the texture processing apparatus for the virtual model includes:

[0126] The third processing subunit is used to adjust the preset rotation matrix based on the provisional selection value of the pixel to obtain the target rotation matrix, and use the target rotation matrix as the texture coordinate rotation information of the pixel.

[0127] In some embodiments, the texture processing apparatus for the virtual model includes:

[0128] The calculation subunit is used to perform transformation calculation on the texture coordinates of the pixel based on the target rotation matrix of the pixel to obtain the rotated texture coordinates of the pixel.

[0129] This application provides a texture processing device for a virtual model. A first acquisition unit 201 acquires a mask map corresponding to the base normal map of a detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not all equal. The detail texture to be rendered is a detail texture set for a target virtual model. A second acquisition unit 202 acquires the mask brightness value of each pixel in the mask map and converts each mask brightness value into texture coordinate rotation information. Different mask brightness values ​​correspond to different texture coordinate transformation information. A calculation unit... 203. Based on the texture coordinate rotation information corresponding to each pixel, the texture coordinates of the pixel are transformed and calculated to obtain the rotated texture coordinates of each pixel; the sampling unit 204 samples the preset detail normal map according to the rotated texture coordinates to obtain sampled detail normal information; the fusion unit 205 fuses the sampled normal information with the first normal information carried by the base normal map to obtain second normal information; the rendering unit 206 performs lighting and shadow rendering processing on the base normal map based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model. In this embodiment, the pixel information of the base normal map can be adjusted according to the mask map and detail normal map, which include multiple non-masked areas with different mask brightness values, so that the texture display effect in different texture areas of the base normal map is different, improving the realism of the rendered virtual embroidery model and enhancing the user's visual experience.

[0130] Accordingly, this application also provides a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Figure 6 As shown, Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0131] The processor 301 is the control center of the computer device 300. It connects various parts of the computer device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it performs various functions of the computer device 300 and processes data, thereby monitoring the computer device 300 as a whole.

[0132] In this embodiment, the processor 301 in the computer device 300 loads the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 runs the applications stored in the memory 302 to achieve various functions:

[0133] Obtain the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is the detail texture set for the target virtual model.

[0134] Obtain the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information. Different mask brightness values ​​correspond to different texture coordinate transformation information.

[0135] The texture coordinates of each pixel are transformed and calculated based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel.

[0136] Based on the rotated texture coordinates, the preset detail normal map is sampled to obtain sampled detail normal information;

[0137] The sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information;

[0138] Based on the mask brightness value in the mask map and the second normal information, the base normal map is subjected to lighting and shadow rendering to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

[0139] In one embodiment, obtaining the mask map corresponding to the base normal map of the detail texture to be rendered includes:

[0140] A texture to be processed is obtained, and the texture to be processed is processed based on the texture regions of multiple detail textures to be rendered in the base normal map to obtain a processed texture, wherein the processed texture includes multiple regions to be processed, and the regions to be processed correspond one-to-one with the texture regions.

[0141] A masking brightness value is set for each of the multiple areas to be processed to obtain multiple unmasked areas, wherein the masking brightness values ​​of the unmasked areas are not completely equal.

[0142] A specified mask brightness value is set for other areas besides the multiple areas to be processed to obtain a mask texture, wherein the specified mask brightness value is the mask brightness value that makes the other areas black.

[0143] In one embodiment, before performing lighting and shadow rendering processing on the base normal map based on the mask brightness value in the mask map and the second normal information, the method further includes:

[0144] The display information for each pixel is generated based on the mask brightness value of each pixel in the mask texture;

[0145] The basic normal map is subjected to lighting and shadow rendering based on the display information of each pixel and the second normal information to obtain the rendered detail texture.

[0146] In one embodiment, generating display information for each pixel based on the mask brightness value of each pixel in the mask texture includes:

[0147] Determine the relationship between the mask brightness value of each pixel and the preset brightness reference value;

[0148] If the mask brightness value of the pixel is greater than the preset brightness reference value, then the pixel intensity of the pixel is set to the first preset value;

[0149] If the mask brightness value of the pixel is less than the preset brightness reference value, then the pixel intensity of the pixel is set to a second preset value, wherein the first preset value is greater than the second preset value.

[0150] In one embodiment, obtaining the mask brightness value of each pixel in the mask texture and converting each mask brightness value into texture coordinate rotation information includes:

[0151] The mask brightness value of each pixel in the mask texture is processed based on the preset angle difference value and the preset angle offset value, and each mask brightness value is converted into texture coordinate rotation information.

[0152] In one embodiment, the process of processing the mask brightness value of each pixel in the mask texture based on a preset angle difference value and a preset angle offset value, and converting each mask brightness value into texture coordinate rotation information, includes:

[0153] Obtain the product between the mask brightness value of the pixel and the preset angle difference value;

[0154] The sum of the product and the preset angle offset value is obtained as the provisional rotation value of the pixel.

[0155] The texture coordinate rotation information of the pixel is generated based on the provisional rotation value of the pixel and the preset rotation matrix.

[0156] In one embodiment, generating texture coordinate rotation information of the pixel based on a provisional rotation value and a preset rotation matrix includes:

[0157] The preset rotation matrix is ​​adjusted based on the provisional selection value of the pixel to obtain the target rotation matrix, and the target rotation matrix is ​​used as the texture coordinate rotation information of the pixel.

[0158] In one embodiment, the step of transforming and calculating the texture coordinates of the pixels based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel includes:

[0159] The texture coordinates of the pixel are transformed and calculated based on the target rotation matrix of the pixel to obtain the rotated texture coordinates of the pixel.

[0160] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0161] Optional, such as Figure 6As shown, the computer device 300 also includes: a touch screen display 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch screen display 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 6 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0162] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.

[0163] In this embodiment, a game application is executed by processor 301 to generate a graphical user interface (GUI) on touch display screen 303. The touch display screen 303 is used to present the GUI and receive user commands generated by the GUI.

[0164] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.

[0165] Audio circuitry 305 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and output to processor 301 for processing. The audio data is then transmitted via radio frequency circuitry 304 to, for example, another computer device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.

[0166] The input unit 306 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0167] Power supply 307 is used to supply power to various components of computer device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0168] although Figure 6 As not shown in the diagram, computer equipment 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0169] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0170] As can be seen from the above, the computer device provided in this embodiment obtains a mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is a detail texture set for the target virtual model. Then, it obtains the mask brightness value of each pixel in the mask map and converts each mask brightness value into texture coordinate rotation information. Different mask brightness values ​​correspond to different texture coordinate transformation information. Next, according to... The texture coordinates of each pixel are transformed and calculated using the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel. Then, based on the rotated texture coordinates, a preset detail normal map is sampled to obtain sampled detail normal information. Next, the sampled normal information is fused with the first normal information carried by the base normal map to obtain second normal information. Finally, the base normal map is subjected to lighting and shadow rendering processing based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, which is then displayed on the target virtual model. In this embodiment, the pixel information of the base normal map can be adjusted based on the mask map and detail normal map, which include multiple non-masked areas with different mask brightness values, so that the texture display effect in different texture areas of the base normal map is different, improving the realism of the rendered virtual embroidery model and enhancing the user's visual experience.

[0171] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0172] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute steps in any of the texture processing methods for virtual models provided in embodiments of this application. For example, the computer program can execute the following steps:

[0173] Obtain the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is the detail texture set for the target virtual model.

[0174] Obtain the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information. Different mask brightness values ​​correspond to different texture coordinate transformation information.

[0175] The texture coordinates of each pixel are transformed and calculated based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel.

[0176] Based on the rotated texture coordinates, the preset detail normal map is sampled to obtain sampled detail normal information;

[0177] The sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information;

[0178] Based on the mask brightness value in the mask map and the second normal information, the base normal map is subjected to lighting and shadow rendering to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

[0179] In one embodiment, obtaining the mask map corresponding to the base normal map of the detail texture to be rendered includes:

[0180] A texture to be processed is obtained, and the texture to be processed is processed based on the texture regions of multiple detail textures to be rendered in the base normal map to obtain a processed texture, wherein the processed texture includes multiple regions to be processed, and the regions to be processed correspond one-to-one with the texture regions.

[0181] A masking brightness value is set for each of the multiple areas to be processed to obtain multiple unmasked areas, wherein the masking brightness values ​​of the unmasked areas are not completely equal.

[0182] A specified mask brightness value is set for other areas besides the multiple areas to be processed to obtain a mask texture, wherein the specified mask brightness value is the mask brightness value that makes the other areas black.

[0183] In one embodiment, before performing lighting and shadow rendering processing on the base normal map based on the mask brightness value in the mask map and the second normal information, the method further includes:

[0184] The display information for each pixel is generated based on the mask brightness value of each pixel in the mask texture;

[0185] The basic normal map is subjected to lighting and shadow rendering based on the display information of each pixel and the second normal information to obtain the rendered detail texture.

[0186] In one embodiment, generating display information for each pixel based on the mask brightness value of each pixel in the mask texture includes:

[0187] Determine the relationship between the mask brightness value of each pixel and the preset brightness reference value;

[0188] If the mask brightness value of the pixel is greater than the preset brightness reference value, then the pixel intensity of the pixel is set to the first preset value;

[0189] If the mask brightness value of the pixel is less than the preset brightness reference value, then the pixel intensity of the pixel is set to a second preset value, wherein the first preset value is greater than the second preset value.

[0190] In one embodiment, obtaining the mask brightness value of each pixel in the mask texture and converting each mask brightness value into texture coordinate rotation information includes:

[0191] The mask brightness value of each pixel in the mask texture is processed based on the preset angle difference value and the preset angle offset value, and each mask brightness value is converted into texture coordinate rotation information.

[0192] In one embodiment, the process of processing the mask brightness value of each pixel in the mask texture based on a preset angle difference value and a preset angle offset value, and converting each mask brightness value into texture coordinate rotation information, includes:

[0193] Obtain the product between the mask brightness value of the pixel and the preset angle difference value;

[0194] The sum of the product and the preset angle offset value is obtained as the provisional rotation value of the pixel.

[0195] The texture coordinate rotation information of the pixel is generated based on the provisional rotation value of the pixel and the preset rotation matrix.

[0196] In one embodiment, generating texture coordinate rotation information of the pixel based on a provisional rotation value and a preset rotation matrix includes:

[0197] The preset rotation matrix is ​​adjusted based on the provisional selection value of the pixel to obtain the target rotation matrix, and the target rotation matrix is ​​used as the texture coordinate rotation information of the pixel.

[0198] In one embodiment, the step of transforming and calculating the texture coordinates of the pixels based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel includes:

[0199] The texture coordinates of the pixel are transformed and calculated based on the target rotation matrix of the pixel to obtain the rotated texture coordinates of the pixel.

[0200] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0201] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0202] Because the computer program stored in the storage medium obtains the mask map corresponding to the base normal map of the detail texture to be rendered, wherein the base normal map includes multiple texture regions of the detail texture to be rendered, and the non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal, the detail texture to be rendered is a detail texture set for the target virtual model; then, it obtains the mask brightness value of each pixel in the mask map, converts each mask brightness value into texture coordinate rotation information, wherein the texture coordinate transformation information corresponding to different mask brightness values ​​is different; then, according to The texture coordinates of each pixel are transformed and calculated using the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel. Then, based on the rotated texture coordinates, a preset detail normal map is sampled to obtain sampled detail normal information. Next, the sampled normal information is fused with the first normal information carried by the base normal map to obtain second normal information. Finally, the base normal map is subjected to lighting and shadow rendering processing based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, which is then displayed on the target virtual model. In this embodiment, the pixel information of the base normal map can be adjusted based on the mask map and detail normal map, which include multiple non-masked areas with different mask brightness values, so that the texture display effect in different texture areas of the base normal map is different, improving the realism of the rendered virtual embroidery model and enhancing the user's visual experience.

[0203] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0204] The foregoing has provided a detailed description of a texture processing method, apparatus, computer device, and storage medium for a virtual model provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the technical solutions and core ideas of this application. Those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A texture processing method for a virtual model, characterized in that, include: Obtain the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is the detail texture set for the target virtual model. Obtain the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information. Different mask brightness values ​​correspond to different texture coordinate transformation information. The texture coordinates of each pixel are transformed and calculated based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel. Based on the rotated texture coordinates, the preset detail normal map is sampled to obtain sampled detail normal information; The sampled normal information is fused with the first normal information carried by the base normal map to obtain the second normal information; Based on the mask brightness value in the mask map and the second normal information, the base normal map is subjected to lighting and shadow rendering to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

2. The texture processing method for virtual models according to claim 1, characterized in that, The process of obtaining the mask map corresponding to the base normal map of the detail texture to be rendered includes: A texture to be processed is obtained, and the texture to be processed is processed based on the texture regions of multiple detail textures to be rendered in the base normal map to obtain a processed texture, wherein the processed texture includes multiple regions to be processed, and the regions to be processed correspond one-to-one with the texture regions. A masking brightness value is set for each of the multiple areas to be processed to obtain multiple unmasked areas, wherein the masking brightness values ​​of the unmasked areas are not completely equal. A specified mask brightness value is set for other areas besides the multiple areas to be processed to obtain a mask texture, wherein the specified mask brightness value is the mask brightness value that makes the other areas black.

3. The texture processing method for virtual models according to claim 1, characterized in that, Before performing lighting and shadow rendering processing on the base normal map based on the mask brightness value in the mask map and the second normal information, the method further includes: The display information for each pixel is generated based on the mask brightness value of each pixel in the mask texture; The basic normal map is subjected to lighting and shadow rendering based on the display information of each pixel and the second normal information to obtain the rendered detail texture.

4. The texture processing method for virtual models according to claim 3, characterized in that, The step of generating display information for each pixel based on the mask brightness value of each pixel in the mask texture includes: Determine the relationship between the mask brightness value of each pixel and the preset brightness reference value; If the mask brightness value of the pixel is greater than the preset brightness reference value, then the pixel intensity of the pixel is set to the first preset value; If the mask brightness value of the pixel is less than the preset brightness reference value, then the pixel intensity of the pixel is set to a second preset value, wherein the first preset value is greater than the second preset value.

5. The texture processing method for virtual models according to claim 1, characterized in that, The step of obtaining the mask brightness value of each pixel in the mask texture and converting each mask brightness value into texture coordinate rotation information includes: The mask brightness value of each pixel in the mask texture is processed based on the preset angle difference value and the preset angle offset value, and each mask brightness value is converted into texture coordinate rotation information.

6. The texture processing method for a virtual model according to claim 5, characterized in that, The process of processing the mask brightness value of each pixel in the mask texture based on preset angle difference and preset angle offset values, converting each mask brightness value into texture coordinate rotation information, includes: Obtain the product between the mask brightness value of the pixel and the preset angle difference value; The sum of the product and the preset angle offset value is obtained as the provisional rotation value of the pixel. The texture coordinate rotation information of the pixel is generated based on the provisional rotation value of the pixel and the preset rotation matrix.

7. The texture processing method for a virtual model according to claim 6, characterized in that, The process of generating texture coordinate rotation information for the pixel based on the provisional rotation value and preset rotation matrix includes: The preset rotation matrix is ​​adjusted based on the provisional selection value of the pixel to obtain the target rotation matrix, and the target rotation matrix is ​​used as the texture coordinate rotation information of the pixel.

8. The texture processing method for a virtual model according to claim 7, characterized in that, The step of transforming and calculating the texture coordinates of each pixel based on the texture coordinate rotation information corresponding to each pixel to obtain the rotated texture coordinates of each pixel includes: The texture coordinates of the pixel are transformed and calculated based on the target rotation matrix of the pixel to obtain the rotated texture coordinates of the pixel.

9. A texture processing device for a virtual model, characterized in that, include: The first acquisition unit is used to acquire the mask map corresponding to the base normal map of the detail texture to be rendered. The base normal map includes multiple texture regions of the detail texture to be rendered. The non-masked regions of the mask map correspond one-to-one with the texture regions, and the mask brightness values ​​of the non-masked regions are not completely equal. The detail texture to be rendered is a detail texture set for the target virtual model. The second acquisition unit is used to acquire the mask brightness value of each pixel in the mask texture, and convert each mask brightness value into texture coordinate rotation information, wherein different mask brightness values ​​correspond to different texture coordinate transformation information. The calculation unit is used to perform transformation calculation on the texture coordinates of the pixel based on the texture coordinate rotation information corresponding to each pixel, so as to obtain the rotated texture coordinates of each pixel. The sampling unit is used to sample the preset detail normal map according to the rotated texture coordinates to obtain sampled detail normal information; The fusion unit is used to fuse the sampled normal information with the first normal information carried by the base normal map to obtain the second normal information; The rendering unit is used to perform lighting and shadow rendering processing on the base normal map based on the mask brightness value in the mask map and the second normal information to obtain the rendered detail texture, so as to display the rendered detail texture on the target virtual model.

10. A computer device, characterized in that, The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the steps of the texture processing method for the virtual model as described in any one of claims 1 to 8 by calling the computer program stored in the memory.

11. 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 steps of the texture processing method for a virtual model as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and device for generating fog mask map

    CN106780642A

  • Virtual reality model rendering method and device

    CN109377546A