Virtual object model rendering method and device, computer equipment and storage medium

By generating a target mask map and mapping the transparency information of the texture map, the problem of requiring additional segmentation when rendering the virtual object model is solved, and efficient rendering effects are achieved.

CN119359836APending Publication Date: 2025-01-24NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411370679.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the prior art, when rendering virtual object models, additional segmentation of the model is needed to achieve translucent effects, resulting in increased workload of art production personnel and increased rendering energy consumption.

Method used

By obtaining the initial texture map of the virtual object model, the target mask map is generated, and the transparency information of the texture map is mapped based on the brightness information of the mask map to obtain the elimination reference value, and the pixel elimination operation is performed to obtain the processed texture map. , and finally rendering based on the processed texture map.

Benefits of technology

There is no need to segment the virtual object model or the initial texture map. It can retain the pixels of the nearly completely transparent part during the transparency test operation, reducing the workload and rendering energy consumption, thus improving the rendering efficiency of the virtual object model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359836A_ABST
    Figure CN119359836A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a rendering method and device of a virtual object model, computer equipment and a computer readable storage medium. According to the scheme, the initial texture map of the virtual object model is obtained; generating a target mask map corresponding to the initial texture map according to the initial texture map; based on the brightness information of each pixel point in the target mask map, carrying out mapping processing on transparency information of each pixel point in the initial texture map to obtain a rejection reference value corresponding to each pixel point; removing the pixel points in the initial texture map according to the removing reference value to obtain a processed texture map; and rendering the virtual object model based on the processed texture map. According to the embodiment of the invention, the virtual object model or the initial texture map does not need to be segmented, the pixel points close to the completely transparent part can be reserved during the transparency test operation, the workload is reduced, and the rendering efficiency of the virtual object model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a rendering method, device, computer equipment and computer-readable storage medium for a virtual object model. Background Art

[0002] With the popularization of computer graphics technology and the development of the film and television game industry, it is often necessary to render different materials for virtual object models in games or film and television games to achieve specific display effects to increase the expressiveness of virtual object models, thereby improving the user's gaming or visual experience. For example, translucent material rendering can be used to achieve various hollowing and translucent requirements of virtual object models.

[0003] In the related art, the semi-transparent rendering of the virtual object model is achieved by mixing the two modes of transparency blending (alpha blend) and transparency test (alpha test). When performing transparency test operation on the virtual object model, in order to avoid removing the part with transparency value (that is, alpha channel value) close to 0, it is usually necessary to separate the completely opaque part of the model from the part that needs to be semi-transparent with vertices and lines, so that the opaque hollow part uses transparency test, and the part that needs to be semi-transparent is semi-transparent blended. However, the additional segmentation of the model requires more vertices and lines, which increases the workload of the art production staff in making the model on the one hand, and more vertices also increase the data volume and rendering energy consumption of the model on the other hand. Summary of the invention

[0004] Embodiments of the present application provide a method, apparatus, computer device, and computer-readable storage medium for rendering a virtual object model, which can improve the rendering efficiency of the virtual object model.

[0005] The present application provides a method for rendering a virtual object model, including:

[0006] Obtaining an initial texture map of the virtual object model;

[0007] Generate a target mask map corresponding to the initial texture map according to the initial texture map, wherein the pixels in the initial texture map correspond to the pixels in the target mask map one by one;

[0008] Based on the brightness information of each pixel in the target mask map, the transparency information of each pixel in the initial texture map is mapped to obtain a culling reference value corresponding to each pixel;

[0009] Performing a culling operation on the pixel points in the initial texture map according to the culling reference value to obtain a processed texture map;

[0010] The virtual object model is rendered based on the processed texture map.

[0011] Accordingly, an embodiment of the present application further provides a rendering device for a virtual object model, comprising:

[0012] A first acquisition unit, used to acquire an initial texture map of a virtual object model;

[0013] A generating unit, configured to generate a target mask map corresponding to the initial texture map according to the initial texture map, wherein the pixels in the initial texture map correspond to the pixels in the target mask map in a one-to-one manner;

[0014] A processing unit, configured to map the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map, so as to obtain a culling reference value corresponding to each pixel;

[0015] A culling unit, configured to perform a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map;

[0016] A rendering unit is used to render the virtual object model based on the processed texture map.

[0017] Correspondingly, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes any mapping processing method provided in the embodiments of the present application.

[0018] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the above-mentioned mapping processing method.

[0019] After completing the design of the color map of the bloodstain effect of the virtual object, the embodiment of the present application can convert the transparency information of the color map in the RGB color space into the color parameter in the HSV color space, and then determine the candidate processing area in the color map based on the pixel points whose color parameters meet the bloodstain color parameter range; determine the area that needs to be adjusted for the bloodstain effect from the candidate processing area to obtain the bloodstain area; adjust the material parameters of the bloodstain area to obtain the bloodstain effect map after the bloodstain effect is adjusted. In this way, the rendering efficiency of the virtual object model can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A flowchart of a method for rendering a virtual object model provided in an embodiment of the present application.

[0022] Figure 2 A schematic diagram of an application scenario of a method for rendering a virtual object model provided in an embodiment of the present application.

[0023] Figure 3 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application.

[0024] Figure 4 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application.

[0025] Figure 5 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application.

[0026] Figure 6 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application.

[0027] Figure 7 A structural block diagram of a rendering device for a virtual object model provided in an embodiment of the present application.

[0028] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0030] The embodiments of the present application provide a rendering method, device, computer-readable storage medium and computer equipment for a virtual object model. Specifically, the rendering method of the virtual object model of the embodiments of the present application can be performed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA), etc. The server can be an independent physical server, or 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 communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and big data and artificial intelligence platforms.

[0031] For example, the computer device can be a terminal, which can obtain an initial texture map of a virtual object model; generate a target mask map corresponding to the initial texture map based on the initial texture map, and the pixels in the initial texture map correspond one to one with the pixels in the target mask map; based on the brightness information of each pixel in the target mask map, map the transparency information of each pixel in the initial texture map to obtain a culling reference value corresponding to each pixel; culling is performed on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map; and the virtual object model is rendered based on the processed texture map.

[0032] Based on the above problems, the embodiments of the present application provide a first method, apparatus, computer device and computer-readable storage medium for rendering a virtual object model, which can improve the rendering efficiency of the virtual object model.

[0033] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0034] An embodiment of the present application provides a method for rendering a virtual object model. The method can be executed by a terminal or a server. The embodiment of the present application takes the method for rendering a virtual object model executed by a terminal as an example for explanation.

[0035] See also Figure 1 , Figure 1 A schematic diagram of a flow chart of a method for rendering a virtual object model provided in an embodiment of the present application. The specific flow of the method for rendering a virtual object model may be as follows:

[0036] 101. Obtain an initial texture map of the virtual object model.

[0037] In the embodiments of the present application, the virtual object model refers to a digital reconstruction or abstract representation of a physical object in a virtual space. By digitally processing the basic elements of a physical object (such as geometry, rules, behavior, and physical information, etc.), a virtual object that can be simulated, analyzed, and operated in a computer environment is created. The virtual object model may include a two-dimensional model and a three-dimensional model.

[0038] Among them, virtual space refers to the digital scene outlined by the computer through digital communication technology. The virtual scene can be a three-dimensional space scene or a two-dimensional scene, etc.

[0039] In some embodiments, the virtual scene may be a game scene, and the virtual object may be a game object in the game scene, etc.

[0040] Among them, texture mapping can be used to paste any type of pictures (textures) on the surface of the virtual object model to improve the reality and detail of the scene. These pictures can be any type of pattern or style.

[0041] Specifically, when applying a texture map to a virtual object model, pixels in the texture image may be mapped onto the surface of the virtual object model by defining texture coordinates (usually fractions in the range of [0, 1]).

[0042] In some embodiments, the initial texture map can be used to render the color of the surface of the virtual object model, and the initial texture map can be a color map. The color map can be used to add color information to the surface of the model. The color map usually contains the color data of the model surface. The virtual object model is rendered by the color map, so that the model can present a rich color effect when rendered.

[0043] 102. Generate a target mask map corresponding to the initial texture map according to the initial texture map.

[0044] Among them, the target mask map can be used to divide the parts of the initial texture map indicating complete transparency and complete opacity from the parts of the initial texture map indicating between complete transparency and complete opacity, that is, the target mask map is divided into two areas, one area corresponds to the parts of the initial texture map indicating complete transparency and complete opacity, and the other area corresponds to the parts of the initial texture map indicating between complete transparency and complete opacity.

[0045] In the embodiment of the present application, since the target mask map is generated based on the initial texture map, the target mask map has the same size as the initial texture map, and the pixels in the initial texture map correspond one-to-one to the pixels in the target mask map.

[0046] In some embodiments, in order to avoid removing some pixels close to transparency when performing transparency test on the initial texture map, the step of "generating a target mask map corresponding to the initial texture map according to the initial texture map" may include the following operations:

[0047] Create an initial mask map of the same size as the initial texture map;

[0048] According to the transparency information of each pixel in the initial texture map, the target area is determined from the initial mask map;

[0049] The brightness values ​​of the pixels in the target area are adjusted from the first brightness value to the second brightness value to obtain a target mask map.

[0050] In the embodiment of the present application, the mask map is also called a mask map. The principle of the mask map is to use the grayscale information of the image to set a mask, display the area of ​​interest, and mask the area of ​​no interest. The area of ​​interest can be an area that needs to be displayed or processed.

[0051] Among them, creating an initial mask map with the same size as the initial texture map may include: drawing an image with the same size as the initial texture map through map making software, and then setting the brightness value of the pixel points in the image to the first brightness value, thereby obtaining the initial mask map.

[0052] The brightness value of a pixel is also called the grayscale value. The grayscale value refers to the color depth of a pixel in a black and white image, and generally ranges from 0 to 1, with white being 1 and black being 0.

[0053] In some embodiments, the first brightness value may be 0, that is, the initial mask map may be a completely black map.

[0054] For example, see Figure 2 , Figure 2 A schematic diagram of an application scenario of a method for rendering a virtual object model provided in an embodiment of the present application. Figure 2 The created initial mask map is shown. The size of the initial mask map is the same as that of the initial texture map, and the brightness value of each pixel is 0.

[0055] In some embodiments, the step of “determining the target area from the initial mask map according to the transparency information of each pixel in the initial texture map” may include the following operations:

[0056] Obtain the transparency value of each pixel in the initial texture map under the transparency channel to obtain transparency information;

[0057] Determine a target pixel point whose transparency value meets a preset transparency value from the initial texture map;

[0058] According to the correspondence between the pixels of the initial texture map and the initial mask map, the region where the pixel corresponding to the target pixel is located is determined from the initial mask map to obtain the target region.

[0059] In the embodiment of the present application, the transparency information of each pixel in the initial texture map refers to the transparency value of each pixel.

[0060] The initial texture map may include a transparency channel, namely, an alpha channel, which may be used to store transparency information of each pixel, namely, a transparency value. The transparency value may range from 0 to 1, wherein 0 represents complete transparency and 1 represents complete opacity.

[0061] Specifically, the transparency value corresponding to each pixel point can be read from the transparency channel of the initial texture map to obtain the transparency information.

[0062] Determining the target pixel point whose transparency value meets the preset transparency value from the initial texture map may include: selecting the pixel point whose transparency value meets the preset transparency value from all the pixels of the initial texture map as the target pixel point.

[0063] For example, the preset transparency values ​​may include 0 and 1. Then, from all the pixels of the initial texture map, pixels with a transparency value of 0 or 1 may be screened as target pixels.

[0064] In some embodiments, the correspondence between the pixels of the initial texture map and the initial mask map may include: each pixel in the initial texture map corresponds to each pixel in the initial mask map based on position, for example, the pixel in the upper left position in the initial texture map corresponds to the pixel in the upper left position in the initial mask map.

[0065] Then, based on the correspondence between the pixels of the initial texture map and the initial mask map, determining the area where the pixels corresponding to the target pixels are located from the initial mask map can include: determining the target position of the target pixel in the initial texture map, and then determining the pixels at the target position from the initial mask map, obtaining the pixels in the initial mask map corresponding to the target pixel, and then the area where these pixels are located in the initial mask map can be used as the target area.

[0066] Furthermore, the brightness values ​​of the pixels in the target area may be adjusted from the first brightness value to the second brightness value, thereby obtaining a target mask map.

[0067] Among them, the second brightness value can be 1. By adjusting the brightness value of the pixel points in the target area in the initial mask map to 1, the target area can be displayed in white to distinguish it from the area outside the target area in the initial mask map, thereby obtaining the target mask map.

[0068] For example, see Figure 3 , Figure 3 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application. Figure 3 The target mask map is obtained by processing the initial mask map, wherein the brightness value of the pixel points in the target area of ​​the target mask map is 1, that is, displayed as white; the brightness value of the pixel points in the non-target area is 0, that is, displayed as black.

[0069] In some embodiments, creating a target mask map based on an initial texture map may specifically include the following steps:

[0070] (1) determining pixels with a transparency value of 0 in the initial texture map, and then adjusting the brightness values ​​of the pixels corresponding to these pixels in the initial mask map to 1, thereby obtaining a first processed mask map;

[0071] For example, see Figure 4 , Figure 4 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application. Figure 4 The left side shows the alpha channel image of the initial texture map. In the alpha channel image, the transparency value of the pixels in the pure black part is 1, the transparency value of the pixels in the pure white part is 0, and the transparency value of the pixels in the remaining part is between 0 and 1.

[0072] Figure 4 The right side shows that in the initial mask map, the brightness values ​​of the pixels corresponding to the pixels with a transparency value of 0 in the initial texture map are adjusted to 1, thereby obtaining the first processed mask map.

[0073] (2) determining pixels in the initial texture map whose transparency value is 1, and then adjusting the brightness values ​​of the pixels corresponding to these pixels in the first processed mask map to 1, thereby obtaining a second processed mask map;

[0074] For example, see Figure 5 , Figure 5 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application. Figure 5 It shows that in the first processed mask map, the brightness values ​​of the pixels corresponding to the pixels with a transparency value of 1 in the initial texture map are adjusted to 1, so as to obtain the second processed mask map.

[0075] (3) Determine the edge adjacent portion of the portion with a transparency value of 1 and the portion with a transparency value of 0 in the initial texture map, and then adjust the brightness value of the pixel point corresponding to the edge adjacent portion in the second processed mask map to 1 to obtain the target mask map.

[0076] For example, see Figure 6 , Figure 6 A schematic diagram of an application scenario of another method for rendering a virtual object model provided in an embodiment of the present application. Figure 6 It is shown that in the second processed mask map, the brightness values ​​of the pixels corresponding to the edge adjacent parts in the initial texture map are adjusted to 1 to obtain the target mask map.

[0077] 103. Based on the brightness information of each pixel in the target mask map, the transparency information of each pixel in the initial texture map is mapped to obtain a culling reference value corresponding to each pixel.

[0078] The culling reference value refers to the value corresponding to each pixel when performing an alpha test on the initial texture map, that is, the alpha test operation can be performed based on the culling reference value corresponding to the pixel.

[0079] Among them, the transparency test is used to crop or filter according to the alpha value of the pixel, so as to control which pixels should be displayed and which should be ignored during the rendering process. The transparency test process may include: during the rendering process, checking the alpha value of each pixel and comparing it with a preset threshold (Cutoff). If the alpha value of the pixel is greater than or equal to the threshold, the pixel will be retained and continue to participate in the subsequent rendering process; if the alpha value of the pixel is less than the threshold, the pixel will be discarded and will not have any effect on the final rendering result.

[0080] In the embodiment of the present application, the rejection reference value corresponding to the pixel point can be used to replace the transparency value of the pixel point, and then during the transparency test, the rejection reference value is compared with the preset threshold value to perform a rejection operation.

[0081] In some embodiments, the step of “mapping the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain a culling reference value corresponding to each pixel” may include the following operations:

[0082] Sample the brightness value corresponding to each pixel in the target mask map to obtain brightness information;

[0083] Sampling the transparency value corresponding to each pixel in the transparency channel of the initial texture map to obtain transparency information;

[0084] According to the brightness value and transparency value corresponding to each pixel, linear interpolation processing is performed to obtain the removal reference value corresponding to each pixel.

[0085] The brightness value corresponding to each pixel in the target mask map is sampled, that is, the grayscale value of each pixel in the target mask map is obtained, so as to obtain the brightness information.

[0086] In some embodiments, sampling the target mask map to obtain the brightness value of the pixel point can be achieved by:

[0087] float4 mask_color=sample(mask_texture, UV);

[0088] float mask = mask_color.x;

[0089] Among them, mask_texture refers to the target mask map, UV refers to the coordinates of the pixels in the target mask map, sample() is the sampling function, and sample(mask_texture, UV) can be used to sample the color values ​​of each pixel of the target mask map, that is, mask_color represents the color value of the pixel in the target mask map.

[0090] Among them, mask_color.x refers to extracting the grayscale value from the color value of the pixel in the target mask map, thereby obtaining the brightness value mask of the pixel.

[0091] The transparency value corresponding to each pixel in the transparency channel of the initial texture map is sampled, that is, the transparency value of each pixel in the initial texture map is obtained to obtain transparency information.

[0092] In some embodiments, sampling the initial texture map to obtain the transparency value of the pixel point can be achieved by:

[0093] float4 color=sample(texture,UV);

[0094] float alpha_origin=color.w;

[0095] Among them, texture refers to the initial texture map, UV refers to the coordinates of the pixels in the initial texture map, sample() is the sampling function, and sample(texture, UV) can be used to sample the color value of each pixel in the initial texture map, that is, color represents the color value of the pixel in the initial texture map.

[0096] Among them, color.w refers to extracting the transparency value from the color value of the pixel point in the initial texture map, thereby obtaining the transparency value alpha_origin of the pixel point.

[0097] In some embodiments, according to the brightness value and transparency value corresponding to each pixel point, the linear interpolation processing can be performed as follows:

[0098] float alpha_for_cull=lerp(1.0, alpha_origin, mask);

[0099] Among them, 1.0 is the preset parameter, alpha_origin refers to the transparency value of the pixel, and mask refers to the brightness value of the pixel. lerp() is the interpolation function, lerp(1.0, alpha_origin, mask) = 1.0 + (alpha_origin-1.0) * mask; alpha_for_cull refers to the calculated reference value for culling corresponding to the pixel.

[0100] For each pixel point, the corresponding reference value for elimination can be calculated according to the above interpolation function.

[0101] For example, the pixels in the initial texture map include: pixels a1, a2, a3, ..., an; the pixels in the target mask map include: pixels b1, b2, b3, ..., bn, where a1 corresponds to b1, a2 corresponds to b2, a3 corresponds to b3, ..., and an corresponds to bn.

[0102] Among them, for the pixels in the initial texture map whose transparency values ​​are not 0 and 1, for example, the transparency value of a1 can be 0.5, and the brightness value of b1 corresponding to a1 can be 0. Based on the interpolation function lerp(), the culling reference value corresponding to a1 can be calculated as: 1.0+(0.5-1.0)*0=1.

[0103] Among them, for the pixel points with a transparency value of 0 in the initial texture map, for example, the transparency value of a2 can be 0, and the brightness value of b2 corresponding to a2 can be 1. Based on the interpolation function lerp(), the culling reference value corresponding to a2 can be calculated as: 1.0+(0-1.0)*1=0.

[0104] Among them, for the pixel points with a transparency value of 1 in the initial texture map, for example, the transparency value of a3 can be 1, and the brightness value of b3 corresponding to a3 can be 1. Based on the interpolation function lerp(), the culling reference value corresponding to a3 can be calculated as: 1.0+(1-1.0)*1=1.

[0105] Based on the existing scheme, for the initial texture map, the pixels with a transparency value of 0 will be eliminated, and the pixels with a transparency value in the interval (0, 1) will also be eliminated, and only the pixels with a transparency value of 1 will be retained. However, in fact, the pixels with a transparency value in the interval (0, 1) do not need to be eliminated. Through the above-mentioned interpolation function processing in this scheme, the elimination reference value of these pixels can be calculated to be 1, and then the transparency test processing is performed according to the elimination reference value, so that these pixels can be retained.

[0106] 104. Perform a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map.

[0107] Among them, performing a culling operation on the pixels in the initial texture map according to the culling reference value may include: culling the pixels whose reference culling values ​​do not meet the preset conditions, and the culled pixels are no longer subjected to the subsequent rendering process.

[0108] In some embodiments, the step of “performing a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map” may include the following operations:

[0109] Get the preset culling strength value;

[0110] Calculate the difference between the rejection reference value corresponding to each pixel and the preset rejection intensity value;

[0111] In the initial texture map, the pixels corresponding to the difference values ​​less than the preset threshold are eliminated to obtain the processed texture map.

[0112] The preset culling strength value may be a strength value for pixel culling preset by a designer, and may be set to different values ​​according to different application scenarios, generally 0≤alphatest_cutoff≤1. The larger the preset culling strength alphatest_cutoff value is, the more image edges are culled.

[0113] In some embodiments, the culling operation on the pixels in the initial texture map may be performed as follows:

[0114] clip(alpha_for_cull–alphatest_cutoff);

[0115] Among them, alpha_for_cull refers to the reference culling value corresponding to the pixel point, and alphatest_cutoff is the preset culling strength value. Specifically, by calculating the difference between the reference culling value of each pixel point and the preset culling strength value, if the difference is less than the preset threshold, the corresponding pixel point can be culled; if the difference is not less than the preset threshold, the corresponding pixel point can be retained.

[0116] By performing the pixel culling operation on the preset texture map in the above manner, only pixels with a transparency value of 0, that is, completely transparent pixels, in the preset texture map can be culled.

[0117] 105. Render the virtual object model based on the processed texture map.

[0118] In some embodiments, the step of “rendering the virtual object model based on the processed texture map” may include the following operations:

[0119] Get the color information and transparency information of the pixels that are not eliminated in the processed texture map;

[0120] The virtual object model is rendered according to the color information and the transparency information to achieve a transparent effect of the virtual object model.

[0121] The pixels that are not culled in the processed texture map refer to the pixels that are retained in the initial texture map after the culling operation.

[0122] The processed texture map may further include at least one color channel, and the color channel is used to store the color information of the pixel points.

[0123] For example, the color channel may include an R channel, a G channel, and a B channel, wherein the R channel is used to control the intensity value of red in the color information, the G channel is used to control the intensity value of green in the color information, and the B channel may be used to control the intensity value of blue in the color information.

[0124] The different intensities of red, green, and blue in the R, G, and B channels can represent various colors. In a digital image, the color of each pixel is determined by the intensity values ​​of these three color channels.

[0125] The transparency information refers to the transparency value of each pixel in the alpha channel of the processed texture map.

[0126] Rendering the virtual object model according to the color information and the transparency information may include: rendering the color of the surface position of the virtual object model corresponding to the pixel point according to the color value corresponding to each pixel point in the processed texture map; and rendering the transparency of the surface position of the virtual object model corresponding to the pixel point according to the transparency value corresponding to each pixel point in the processed texture map. Thus, a virtual object model with a transparent effect is obtained.

[0127] In some embodiments, the virtual object model can also achieve a transparency blending effect, and the method can further include the following steps:

[0128] Get background color information for realizing transparency blending effect of virtual object model;

[0129] Based on the transparency value corresponding to the pixel point, the color value of the pixel point in the processed texture map is mixed with the corresponding background color value to obtain a mixed color value;

[0130] The virtual object model is rendered according to the mixed color values ​​corresponding to the pixel points to achieve a transparency mixing effect of the virtual object model.

[0131] Transparency blending is used to blend the color of a semi-transparent object with the background when rendering it, thereby producing a transparent effect. In transparency blending, the output color of each pixel is a mixture of the object color and the background color in a certain ratio, which is usually controlled by the transparency value (Alpha value) of the object.

[0132] In the embodiment of the present application, the background color information refers to the background color that needs to be blended with the virtual object model for transparency. The background color information includes the background color values ​​corresponding to the pixels that are not removed in the processed texture map. That is, the background color information includes the colors that need to be blended for each pixel in the processed texture map.

[0133] Among them, based on the transparency value corresponding to the pixel point, the color value of the pixel point in the processed texture map is mixed with the corresponding background color value, which can include: according to the transparency value corresponding to each pixel point in the processed texture map, the color mixing ratio value corresponding to each pixel point is determined, and then the color information corresponding to the pixel point (that is, the color value in the processed texture map) is mixed with the background color value according to the color mixing ratio value, so as to obtain the mixed color value corresponding to each pixel point.

[0134] Furthermore, the surface position of the virtual object model corresponding to each pixel point may be rendered according to the mixed color value corresponding to each pixel point, thereby obtaining a rendering effect of the virtual object model mixed with the background color.

[0135] In some embodiments, before performing a transparency blending operation on the virtual object model, the virtual object model may be set to a transparency blending mode so that a transparency blending effect can be achieved.

[0136] This solution draws a mask map for the virtual object model, sets the brightness of the pixels in the mask map that do not need to be culled to 0, and sets the brightness of the pixels that need to be culled to 1; then samples the mask map data (i.e. the brightness value of the pixels) during rendering, and then uses the sampled data to map the alpha value of the pixels in the initial texture map to alpha_for_cull, and maps the parts that do not need to be culled to 1, thereby avoiding the culling of this part. Then, alpha_for_cull is used for transparency testing, but the original alpha is still used as the final color output for transparency blending, so that the hollowing out of the area with alpha of 1 can be achieved while ensuring that the low alpha value area is not culled. Without segmentation and different material settings, the same model can be tested for transparency and blended for transparency at the required part at the same time, reducing the workload of art production in the modeling stage.

[0137] The embodiment of the present application discloses a rendering method of a virtual object model, the method comprising: obtaining an initial texture map of the virtual object model; generating a target mask map corresponding to the initial texture map according to the initial texture map, wherein the pixels in the initial texture map correspond to the pixels in the target mask map one by one; mapping the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain a culling reference value corresponding to each pixel; culling the pixels in the initial texture map according to the culling reference value to obtain a processed texture map; rendering the virtual object model based on the processed texture map. There is no need to segment the virtual object model or the initial texture map, and the pixels of the nearly completely transparent part can be retained during the transparency test operation, thereby reducing the workload and improving the rendering efficiency of the virtual object model.

[0138] In order to facilitate better implementation of the virtual object model rendering method provided in the embodiment of the present application, the embodiment of the present application also provides a virtual object model rendering device based on the virtual object model rendering method. The meanings of the terms are the same as those in the virtual object model rendering method, and the specific implementation details can refer to the description in the method embodiment.

[0139] See also Figure 7 , Figure 7 A structural block diagram of a rendering device for a virtual object model provided in an embodiment of the present application, the device comprising:

[0140] A first acquisition unit 301 is used to acquire an initial texture map of a virtual object model;

[0141] A generating unit 302 is used to generate a target mask map corresponding to the initial texture map according to the initial texture map, wherein the pixels in the initial texture map correspond to the pixels in the target mask map one by one;

[0142] The processing unit 303 is used to map the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain a culling reference value corresponding to each pixel;

[0143] A culling unit 304 is used to perform a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map;

[0144] The rendering unit 305 is configured to render the virtual object model based on the processed texture map.

[0145] In some embodiments, the generating unit 302 may include:

[0146] A creating subunit, configured to create an initial mask map having the same size as the initial texture map, wherein the brightness value of each pixel in the initial mask map is a first brightness value;

[0147] A first determining subunit, configured to determine a target area from the initial mask map according to transparency information of each pixel in the initial texture map;

[0148] The adjustment subunit is used to adjust the brightness value of the pixel points in the target area from the first brightness value to a second brightness value to obtain the target mask map.

[0149] In some embodiments, the first determining subunit may be specifically used for:

[0150] Obtaining the transparency value of each pixel in the initial texture map under the transparency channel to obtain the transparency information;

[0151] Determine, from the initial texture map, a target pixel point whose transparency value meets a preset transparency value;

[0152] According to the correspondence between the pixels of the initial texture map and the initial mask map, the region where the pixel corresponding to the target pixel is located is determined from the initial mask map to obtain the target region.

[0153] In some embodiments, the processing unit 303 may include:

[0154] A first sampling subunit is used to sample the brightness value corresponding to each pixel point in the target mask map to obtain the brightness information;

[0155] A second sampling subunit is used to sample the transparency value corresponding to each pixel point in the transparency channel of the initial texture map to obtain the transparency information;

[0156] The processing subunit is used to perform linear interpolation processing according to the brightness value and transparency value corresponding to each pixel point to obtain the elimination reference value corresponding to each pixel point.

[0157] In some embodiments, the culling unit 304 may include:

[0158] A first acquisition subunit, used to acquire a preset culling strength value;

[0159] A calculation subunit, used for calculating the difference between the rejection reference value corresponding to each pixel point and the preset rejection intensity value;

[0160] The elimination subunit is used to eliminate the pixel points corresponding to the difference value less than the preset threshold value in the initial texture map to obtain the processed texture map.

[0161] In some embodiments, the rendering unit 305 may include:

[0162] A second acquisition subunit is used to acquire color information and transparency information of pixels that are not eliminated in the processed texture map;

[0163] The first rendering subunit is used to render the virtual object model according to the color information and the transparency information to achieve a transparent effect of the virtual object model.

[0164] In some embodiments, the rendering unit 305 may include:

[0165] A third acquisition subunit is used to acquire background color information for realizing the transparency blending effect of the virtual object model, wherein the background color information includes background color values ​​corresponding to pixels that are not eliminated in the processed texture map;

[0166] A mixing subunit, configured to mix the color value of the pixel in the processed texture map with the corresponding background color value based on the transparency value corresponding to the pixel to obtain a mixed color value;

[0167] The second rendering subunit is used to render the virtual object model according to the mixed color value corresponding to the pixel point, so as to achieve a transparency mixing effect of the virtual object model.

[0168] The embodiment of the present application discloses a rendering device for a virtual object model, wherein the initial texture map of the virtual object model is obtained by a first acquisition unit 301; a generation unit 302 generates a target mask map corresponding to the initial texture map according to the initial texture map, and the pixels in the initial texture map correspond to the pixels in the target mask map one by one; a processing unit 303 maps the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain a culling reference value corresponding to each pixel; a culling unit 304 culls the pixels in the initial texture map according to the culling reference value to obtain a processed texture map; and a rendering unit 305 renders the virtual object model based on the processed texture map. In this way, the rendering efficiency of the virtual object model can be improved.

[0169] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal. Figure 8 As shown, Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. It will be understood by those skilled in the art 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 in the figure, or combine certain components, or arrange the components differently.

[0170] The processor 501 is the control center of the computer device 500. It uses various interfaces and lines to connect the various parts of the entire computer device 500, executes various functions of the computer device 500 and processes data by running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer device 500 as a whole.

[0171] In the embodiment of the present application, the processor 501 in the computer device 500 will load instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:

[0172] Obtaining an initial texture map of the virtual object model;

[0173] According to the initial texture map, a target mask map corresponding to the initial texture map is generated, and the pixels in the initial texture map correspond to the pixels in the target mask map one by one;

[0174] Based on the brightness information of each pixel in the target mask map, the transparency information of each pixel in the initial texture map is mapped to obtain a culling reference value corresponding to each pixel;

[0175] Perform a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map;

[0176] The virtual object model is rendered based on the processed texture map.

[0177] The embodiment of the present application obtains the initial texture map of the virtual object model; generates a target mask map corresponding to the initial texture map based on the initial texture map; maps the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain a culling reference value corresponding to each pixel; performs a culling operation on the pixels in the initial texture map based on the culling reference value to obtain a processed texture map; and renders the virtual object model based on the processed texture map. There is no need to segment the virtual object model or the initial texture map, and the pixels of the nearly completely transparent part can be retained during the transparency test operation to reduce the workload, thereby improving the rendering efficiency of the virtual object model.

[0178] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0179] Optional, such as Figure 8 As shown, the computer device 500 further includes: a touch screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art can understand that Figure 8 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0180] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces may be composed of graphics, guide information, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 501, and can receive the command sent by the processor 501 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to realize the input function.

[0181] The radio frequency circuit 504 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.

[0182] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data, and then the audio data is output to the processor 501 for processing, and then sent to another computer device through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between an external headset and the computer device.

[0183] The input unit 506 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0184] The power supply 507 is used to supply power to various components of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 507 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0185] although Figure 8 Not shown, the computer device 500 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0186] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0187] As can be seen from the above, the computer device provided in this embodiment can obtain the initial texture map of the virtual object model; based on the initial texture map, generate a target mask map corresponding to the initial texture map, and the pixels in the initial texture map correspond to the pixels in the target mask map one by one; based on the brightness information of each pixel in the target mask map, the transparency information of each pixel in the initial texture map is mapped to obtain a culling reference value corresponding to each pixel; according to the culling reference value, the pixels in the initial texture map are culled to obtain a processed texture map; and the virtual object model is rendered based on the processed texture map.

[0188] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0189] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any one of the virtual object model rendering methods provided in the embodiments of the present application. For example, the computer program can execute the following steps:

[0190] Obtaining an initial texture map of the virtual object model;

[0191] According to the initial texture map, a target mask map corresponding to the initial texture map is generated, and the pixels in the initial texture map correspond to the pixels in the target mask map one by one;

[0192] Based on the brightness information of each pixel in the target mask map, the transparency information of each pixel in the initial texture map is mapped to obtain a culling reference value corresponding to each pixel;

[0193] Perform a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map;

[0194] The virtual object model is rendered based on the processed texture map.

[0195] The embodiment of the present application obtains the initial texture map of the virtual object model; generates a target mask map corresponding to the initial texture map based on the initial texture map; maps the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain a culling reference value corresponding to each pixel; performs a culling operation on the pixels in the initial texture map based on the culling reference value to obtain a processed texture map; and renders the virtual object model based on the processed texture map. There is no need to segment the virtual object model or the initial texture map, and the pixels of the nearly completely transparent part can be retained during the transparency test operation to reduce the workload, thereby improving the rendering efficiency of the virtual object model.

[0196] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0197] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0198] Since the computer program stored in the computer-readable storage medium can execute the steps in any method for rendering a virtual object model provided in the embodiments of the present application, the beneficial effects that can be achieved by any method for rendering a virtual object model provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0199] The above is a detailed introduction to a rendering method, device, computer-readable storage medium and computer equipment for a virtual object model provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for rendering a virtual object model, characterized in that: The method comprises: Obtaining an initial texture map of the virtual object model; Generate a target mask map corresponding to the initial texture map according to the initial texture map, wherein the pixels in the initial texture map correspond to the pixels in the target mask map one by one; Based on the brightness information of each pixel in the target mask map, the transparency information of each pixel in the initial texture map is mapped to obtain a culling reference value corresponding to each pixel; Performing a culling operation on the pixel points in the initial texture map according to the culling reference value to obtain a processed texture map; The virtual object model is rendered based on the processed texture map.

2. The method according to claim 1, characterized in that The step of generating a target mask map corresponding to the initial texture map according to the initial texture map comprises: Creating an initial mask map with the same size as the initial texture map, wherein the brightness value of each pixel in the initial mask map is a first brightness value; Determining a target area from the initial mask map according to transparency information of each pixel in the initial texture map; The brightness values ​​of the pixels in the target area are adjusted from the first brightness value to a second brightness value to obtain the target mask map.

3. The method according to claim 2, characterized in that Determining the target area from the initial mask map according to the transparency information of each pixel in the initial texture map comprises: Obtaining the transparency value of each pixel in the initial texture map under the transparency channel to obtain the transparency information; Determine, from the initial texture map, a target pixel point whose transparency value meets a preset transparency value; According to the correspondence between the pixels of the initial texture map and the initial mask map, the region where the pixel corresponding to the target pixel is located is determined from the initial mask map to obtain the target region.

4. The method according to claim 1, characterized in that: The mapping process is performed on the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map to obtain the culling reference value corresponding to each pixel, including: Sampling the brightness value corresponding to each pixel in the target mask map to obtain the brightness information; Sampling the transparency value corresponding to each pixel point in the transparency channel of the initial texture map to obtain the transparency information; According to the brightness value and transparency value corresponding to each pixel, linear interpolation processing is performed to obtain the removal reference value corresponding to each pixel.

5. The method according to claim 1, characterized in that The step of performing a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map comprises: Get the preset culling strength value; Calculate the difference between the rejection reference value corresponding to each pixel and the preset rejection intensity value; In the initial texture map, pixel points corresponding to difference values ​​less than a preset threshold are eliminated to obtain the processed texture map.

6. The method according to claim 5, characterized in that The rendering of the virtual object model based on the processed texture map comprises: Obtaining color information and transparency information of pixels that are not eliminated in the processed texture map; The virtual object model is rendered according to the color information and the transparency information to achieve a transparent effect of the virtual object model.

7. The method according to claim 6, characterized in that The method further comprises: Acquire background color information for realizing the transparency blending effect of the virtual object model, wherein the background color information includes background color values ​​corresponding to pixels that are not eliminated in the processed texture map; Based on the transparency value corresponding to the pixel point, the color value of the pixel point in the processed texture map is mixed with the corresponding background color value to obtain a mixed color value; The virtual object model is rendered according to the mixed color values ​​corresponding to the pixel points to achieve a transparency mixing effect of the virtual object model.

8. A rendering device for a virtual object model, characterized in that: The device comprises: A first acquisition unit, used to acquire an initial texture map of a virtual object model; A generating unit, configured to generate a target mask map corresponding to the initial texture map according to the initial texture map, wherein the pixels in the initial texture map correspond to the pixels in the target mask map in a one-to-one manner; A processing unit, configured to map the transparency information of each pixel in the initial texture map based on the brightness information of each pixel in the target mask map, so as to obtain a culling reference value corresponding to each pixel; A culling unit, configured to perform a culling operation on the pixels in the initial texture map according to the culling reference value to obtain a processed texture map; A rendering unit is used to render the virtual object model based on the processed texture map.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein: When the processor executes the program, the method for rendering a virtual object model as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the method for rendering a virtual object model according to any one of claims 1 to 7.