Model rendering method and device, electronic equipment and computer readable storage medium

By sampling and processing normal texture maps, color gradient control maps and noise maps, we determine the spectral color and target color texture information, and render the virtual object model, solving the calculation complexity of high calculation when rendering opalite visual effects in the existing technology Problem, efficient rendering effect is achieved.

CN119444963APending Publication Date: 2025-02-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411756217.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art renders the stone model to have opalite visual effects, with high computational complexity and high performance overhead.

Method used

By obtaining the normal texture map of the internal structure of the target object, the sampling process obtains the normal vector and color texture information; obtains the color gradient control map, and sample obtains the color gradient control information; based on this information, the spectral color information and the target color texture information are determined. ; Then obtain the noise map, sample the noise information, and render the virtual object model based on the noise information and the target color texture information.

Benefits of technology

The visual effect of making the virtual object have the target object through tri-sampling is realized, reducing the computational complexity and performance overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444963A_ABST
    Figure CN119444963A_ABST
Patent Text Reader

Abstract

The invention discloses a model rendering method and device, electronic equipment and a computer readable storage medium, and the method comprises the steps: obtaining a normal texture map of an internal structure of a target object, carrying out the sampling processing of the normal texture map, and obtaining a normal vector and color texture information of the internal structure; acquiring a color gradient control map, and sampling the color gradient control map to obtain color gradient control information; based on the color gradient control information and the normal vector, spectrum color information is determined, and based on the color texture information and the spectrum color information, target color texture information of the target object is determined; obtaining a noise map, and carrying out sampling processing on the noise map to obtain noise information; and the virtual object model is rendered based on the noise information and the target color texture information to obtain the virtual object with the visual effect of the target object, so that the calculation complexity and the performance overhead of rendering the model into the virtual object with the visual effect of the target object can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Opal is one of the most beautiful and precious gemstones in the world. Its internal structure can interfere and diffract light, thus producing a color-changing effect. In order to enrich the visual effects of the stones in the game, the stone models in the game can be rendered into stones with the visual effects of opal.

[0003] The current method of rendering a stone model into a stone with the visual effect of an opal stone relies on a large amount of texture sampling or voxel volume calculation, which has high computational complexity and high performance overhead. Summary of the invention

[0004] Embodiments of the present application provide a model rendering method, device, electronic device, and computer-readable storage medium, which can reduce the computational complexity and performance overhead of rendering a model into a virtual object with the visual effects of a target object.

[0005] In a first aspect, an embodiment of the present application provides a model rendering method, the method comprising:

[0006] Acquire a normal texture map of the internal structure of the target object, and perform sampling processing on the normal texture map to obtain normal vectors and color texture information of the internal structure;

[0007] Obtain a color gradient control map, and sample the color gradient control map to obtain color gradient control information;

[0008] Determine spectral color information based on the color gradient control information and the normal vector, and determine target color texture information of the target object based on the color texture information and the spectral color information;

[0009] Obtain a noise map, and sample the noise map to obtain noise information;

[0010] Based on the noise information and the target color texture information, the virtual object model is rendered to obtain a virtual object having the visual effect of the target object.

[0011] In a second aspect, an embodiment of the present application further provides a model rendering device, the device comprising:

[0012] A first sampling module is used to obtain a normal texture map of the internal structure of the target object, and perform sampling processing on the normal texture map to obtain a normal vector and color texture information of the internal structure;

[0013] A second sampling module is used to obtain a color gradient control map and sample the color gradient control map to obtain color gradient control information;

[0014] An information determination module, used to determine the spectral color information based on the color gradient control information and the normal vector, and to determine the target color texture information of the target object based on the color texture information and the spectral color information;

[0015] The third sampling module is used to obtain a noise map and sample the noise map to obtain noise information;

[0016] The model rendering module is used to render the virtual object model based on the noise information and the target color texture information to obtain a virtual object with the visual effect of the target object.

[0017] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of instructions; the above-mentioned processor loads instructions from the above-mentioned memory to execute any one of the model rendering methods provided in the embodiments of the present application.

[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute any model rendering method provided in an embodiment of the present application.

[0019] In an embodiment of the present application, a normal texture map of the internal structure of the target object is obtained, and the normal texture map is sampled to obtain a normal vector and color texture information of the internal structure; a color gradient control map is obtained, and the color gradient control map is sampled to obtain color gradient control information; based on the color gradient control information and the normal vector, spectral color information is determined, and based on the color texture information and the spectral color information, target color texture information of the target object is determined; a noise map is obtained, and the noise map is sampled to obtain noise information; based on the noise information and the target color texture information, a virtual object model is rendered to obtain a virtual object having the visual effect of the target object, so that the virtual object can have the visual effect of the target object by sampling three times, thereby reducing computational complexity and performance overhead. 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 This is a flow chart of an embodiment of the model rendering method provided in the embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a virtual object provided in an embodiment of the present application;

[0023] Figure 3 is another schematic diagram of a virtual object provided in an embodiment of the present application;

[0024] Figure 4 is another schematic diagram of a virtual object provided in an embodiment of the present application;

[0025] Figure 5 is another schematic diagram of a virtual object provided in an embodiment of the present application;

[0026] Figure 6 is another schematic diagram of a virtual object provided in an embodiment of the present application;

[0027] Figure 7 is another schematic diagram of a virtual object provided in an embodiment of the present application;

[0028] Figure 8 It is a schematic diagram of another embodiment of the model rendering method provided in the embodiments of the present application;

[0029] Fig. 9 It is a node schematic diagram for generating an internal structure image provided in an embodiment of the present application;

[0030] Fig.10 is a schematic diagram of a node for generating a normal vector provided in an embodiment of the present application;

[0031] Fig.11 This is a node schematic diagram of generating color texture information provided by an embodiment of the present application;

[0032] Fig.12 It is a node schematic diagram of generating a normal texture map provided by an embodiment of the present application;

[0033] Fig.13 is a schematic diagram of a node for generating a first parallax texture coordinate provided in an embodiment of the present application;

[0034] Fig.14 is another node schematic diagram for generating a normal vector provided in an embodiment of the present application;

[0035] Fig.15 It is a structural schematic diagram of a model rendering device provided in an embodiment of the present application;

[0036] Fig.16 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0038] Before explaining the embodiments of the present application in detail, some terms involved in the embodiments of the present application are first explained.

[0039] Among them, in the description of the embodiments of the present application, the terms "first", "second", etc. may be used in this article to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0040] The embodiments of the present application provide a model rendering method, device, electronic device and computer-readable storage medium. Specifically, the model rendering method of the embodiments of the present application can be executed by an electronic device, wherein the electronic device can be a terminal or a server.

[0041] The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), etc. 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, etc.

[0042] 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 communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms.

[0043] The following is a detailed description of the embodiments in conjunction with the accompanying drawings. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.

[0044] In this embodiment, a terminal is used as an example for illustration. This embodiment provides a model rendering method, such as Figure 1 As shown, the specific process of the model rendering method can be as follows:

[0045] 101. Obtain a normal texture map of the internal structure of the target object, and perform sampling processing on the normal texture map to obtain a normal vector and color texture information of the internal structure.

[0046] Among them, the target object refers to a certain entity with the required visual effect. The required visual effect can be the visual effect produced by interference and / or diffraction of light. The certain entity can be set according to actual conditions. For example, the certain entity can be a gem or glass. The gem can be, for example, opal or labradorite. This embodiment is not limited here.

[0047] The normal texture map refers to a map including normal direction information and color texture information of the internal structure of the target object. The normal direction information indicates the orientation of each point in the internal structure of the target object. The color texture information indicates the texture of the internal structure of the target object.

[0048] The normal direction information may be a normal vector, or the normal direction information may be two component information of the normal vector, and the two component information of the normal vector may be referred to as normal direction information of the normal vector in a first direction and normal direction information of the normal vector in a second direction.

[0049] In this embodiment, the normal direction information and the color texture information are compressed into one map, which reduces the number of subsequent sampling of the map, and reduces the calculation complexity and performance overhead.

[0050] Sampling refers to the process of extracting pixel values ​​from a map. Sampling a normal texture map refers to the process of extracting normal direction information and color texture information from the normal texture map. For example, when the normal direction information is a normal vector, the normal texture map stores the normal vector through the RGB channel and stores the color texture information through the A channel, sampling the normal texture map refers to extracting RGBA values ​​from the normal texture map, or, when the normal direction information is the normal direction information of the normal vector in a first direction and the normal direction information in a second direction, the normal texture map stores the component information of the normal vector in the first direction and the component information in the second direction through the RG channel and stores the color texture information through the B channel, sampling the normal texture map refers to the process of extracting RGB values ​​from the normal texture map.

[0051] Optionally, when the normal vector is stored through the R channel, G channel and B channel of the normal texture map, and the color texture information is stored through the A channel, the normal texture map is sampled to obtain the normal vector and the color texture map. At this time, the normal vector can be first stored in the R channel, G channel and B channel of a map, and the color texture information can be stored in the A channel of the map to obtain the normal texture map, thereby storing the normal vector and the color texture information in the normal texture map.

[0052] Alternatively, when the normal direction information of the normal vector in the first direction and the normal direction information in the second direction are stored through the R channel and the G channel of the normal texture map, the normal texture map is sampled to obtain the normal vector of the internal structure, including:

[0053] Sampling the normal texture map to obtain normal direction information of the internal structure in a first direction and normal direction information in a second direction;

[0054] Determining normal direction information of a third direction based on the normal direction information of the first direction and the normal direction information of the second direction;

[0055] Based on the normal direction information of the first direction, the normal direction information of the second direction, and the normal direction information of the third direction, a normal vector of the internal structure is determined.

[0056] Among them, the normal direction information of the normal vector in the first direction and the normal direction information in the second direction can be stored in the R channel and G channel of a map, and the color texture information can be stored in the B channel of the map to obtain a normal texture map. Since the A channel of the normal texture map has no content, the memory size occupied by the normal texture map can be reduced, thereby further optimizing the performance.

[0057] The terminal may first adjust the normal direction information of the first direction and the normal direction information of the second direction by using the following formula to obtain the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction:

[0058] normal.rg=(texture.rg*2.0)-1.0

[0059] Among them, texture.rg represents the normal direction information of the first direction and the normal direction information of the second direction, normal.rg represents the adjusted normal direction information, and the adjusted normal direction information includes the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction.

[0060] After obtaining the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction, the terminal determines the normal direction information of the third direction based on the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction.

[0061] Specifically, the terminal may perform dot product processing on the adjusted normal direction information and itself to obtain a target dot product result, and then determine the normal direction information in the third direction based on the target dot product result.

[0062] For example, the adjusted normal direction information can be substituted into the following formula to obtain the normal direction information in the third direction:

[0063] normal.b=sqrt(max((1.0-dot(normal.rg,normal.rg)),0.0)))

[0064] Among them, normal.b represents the normal direction information in the third direction, sqrt represents the square root function, max represents the function of taking the maximum value of the two, and dot represents the dot product function.

[0065] After obtaining the normal direction information of the third direction, the terminal combines the normal direction information of the first direction, the normal direction information of the second direction and the normal direction information of the third direction to obtain the normal vector of the internal structure.

[0066] In some embodiments, the normal texture map may be sampled directly according to the texture coordinates of the virtual object model to obtain the normal vector and color texture information.

[0067] In some embodiments, in order to increase the sense of depth, the normal texture map is sampled to obtain the normal vector and color texture information of the internal structure, including:

[0068] Determining a first parallax effect parameter according to the camera vector and a first preset parallax depth parameter;

[0069] Determining first parallax texture coordinates based on the first parallax effect parameter and the texture coordinates of the virtual object model;

[0070] Based on the first parallax texture coordinates, the normal texture map is sampled to obtain the normal vector and color texture information of the internal structure.

[0071] The camera vector refers to a vector pointing from the camera position to the virtual object model. The first preset parallax depth parameter refers to a preset constant value, which can be set according to actual conditions.

[0072] The first parallax effect parameter can be used to control the intensity of the parallax effect of the virtual object model. The first parallax texture coordinates can also be called single parallax sampling texture coordinates. The terminal can multiply the camera vector and the first preset parallax depth parameter to obtain the first parallax effect parameter, which is a vector.

[0073] After obtaining the first parallax effect parameter, the xy value in the first parallax effect parameter is subtracted from each texture coordinate of the virtual object model to obtain the first parallax texture coordinate, and then the normal texture map is sampled based on the first parallax texture coordinate to obtain the normal vector and color texture information of the internal structure, so that the virtual object finally obtained according to the normal vector and color texture information has a sense of depth and better simulates the internal structure of the target object.

[0074] Optionally, if the camera vector is a vector in the tangent space, the process of determining the first parallax effect parameter according to the camera vector and the first preset parallax depth parameter may be:

[0075] Normalize the camera vector in tangent space;

[0076] The normalized camera vector is multiplied by the first preset parallax depth parameter to obtain a first parallax effect parameter.

[0077] If the camera vector is a vector in the world space, the process of determining the first parallax effect parameter according to the camera vector and the first preset parallax depth parameter may be:

[0078] Convert the camera vector from world space to tangent space and normalize the tangent space camera vector;

[0079] The normalized camera vector is multiplied by the first preset parallax depth parameter to obtain a first parallax effect parameter.

[0080] In some embodiments, before obtaining the normal texture map of the internal structure of the target object, the method further includes:

[0081] Acquire the internal structure image of the target object;

[0082] Based on the internal structure image, the normal vector and color texture information of the internal structure of the target object are generated;

[0083] Based on the normal vector and color texture information, a normal texture map of the internal structure of the target object is generated.

[0084] Among them, the normal vector can be represented by an RBG value, and the color texture information can be represented by a grayscale value. The terminal can store the normal vector in the RGB channel of the map, and store the color texture information in the A channel of the map to obtain a normal texture map. Alternatively, the terminal can also store the normal direction information of the first direction and the normal direction information of the second direction in the normal vector in the RG channel of the map, and store the color texture information in the B channel of the map to obtain a normal texture map. At this time, since the A channel of the normal texture map has no storage content, the memory occupied by the normal texture map can be saved, and the performance can be further optimized.

[0085] In some embodiments, based on the internal structure image, the process of generating the normal vector and color texture information of the internal structure of the target object may be:

[0086] Extract the gray value of the internal structure image;

[0087] Based on the grayscale value, the normal vector and color texture information of the internal structure of the target object are generated.

[0088] Among them, the internal structure can be colored based on the grayscale value to obtain a normal vector. Different normal vectors represent different color information, and different color information indicates different normal directions.

[0089] In some embodiments, based on the internal structure image, the process of generating the normal vector of the internal structure of the target object may be:

[0090] Get the first noise map;

[0091] Based on the first noise map, the internal structure image is disturbed to obtain a first target grayscale image;

[0092] Coloring is performed based on the first target grayscale image to obtain a normal vector of the internal structure of the target object.

[0093] The first noise map refers to a noise map used to perturb the internal structure image, and is used to set the distortion degree and direction of each pixel in the internal structure image.

[0094] It can be understood that after the internal structure image is disturbed, a first target grayscale image can be obtained, and the grayscale value of the first target grayscale image can also be obtained. The grayscale value of the first target grayscale image is called the first target grayscale value. At this time, the grayscale corresponding to the first target grayscale value is colored.

[0095] In this embodiment, a first noise map is obtained, and the internal structure image is disturbed based on the first noise map to obtain a first target grayscale image. Coloring is performed based on the first target grayscale image to obtain a normal vector of the internal structure of the target object, so as to increase the details and randomness of the internal structure and enhance the naturalness of the internal structure.

[0096] In some embodiments, based on the first noise map, the internal structure image is disturbed to obtain a first target grayscale image, including:

[0097] Based on the first noise map, distorting the edge boundaries between different pixels in the internal structure image to obtain a first distorted image;

[0098] Performing mapping processing on the first distorted image to obtain a first mapped image;

[0099] Based on the first mask noise information, a non-uniform distortion process is performed on the first mapped image to obtain a first target grayscale image.

[0100] The mapping process of the first distorted image may refer to adjusting the contrast and brightness of the first distorted image. The first mask noise information may include first mask information and first noise information, the first mask information is used to set the area to be distorted in the first mapped image, and the first noise information is used to set the random degree of the non-uniform distortion.

[0101] In this embodiment, based on the first noise map, the edge boundaries between different pixels in the internal structure image are distorted to obtain a first distorted image, the first distorted image is mapped to obtain a first mapped image, and based on the first mask noise information, the first mapped image is non-uniformly distorted to obtain a first target grayscale image, thereby achieving disturbance processing of the internal structure image.

[0102] In some embodiments, generating color texture information of the internal structure of the target object based on the internal structure image includes:

[0103] Get the second noise map;

[0104] Based on the second noise map, texture details are added to the internal structure image to obtain a second target grayscale image;

[0105] Based on the second target grayscale image, color texture information of the internal structure of the target object is generated.

[0106] The second noise map refers to a map that can increase the texture details of the internal structure image. The first noise map and the second noise map can be the same noise map or different noise maps.

[0107] The terminal may perform grayscale gradient processing on the internal structure image to obtain a gradient image, and then add texture details to the gradient image based on the second noise map to obtain a second target grayscale image.

[0108] It can be understood that after adding texture details to the internal structure image, the second target grayscale image can be directly obtained, or the grayscale value of the second target grayscale image can be directly obtained. The grayscale value of the second target grayscale image can be called the second target grayscale value. At this time, color texture information is generated based on the second target grayscale value.

[0109] In this embodiment, a second noise map is obtained, and based on the second noise map, texture details are added to the internal structure image to obtain a second target grayscale image. Based on the second target grayscale image, color texture information of the internal structure of the target object is generated to add texture details to the internal structure and further simulate the visual effect of the internal structure of the target object. For example, when the target object is opal, the texture of the natural mineral section of the internal structure of the opal can be further simulated.

[0110] In some embodiments, adding texture details to the internal structure image based on the second noise map to obtain a second target grayscale image includes:

[0111] Perform grayscale gradient processing on the internal structure image to obtain a gradient image;

[0112] Based on the second noise map, distorting the edge boundaries between different pixels in the gradient image to obtain a second distorted image;

[0113] Performing mapping processing on the second distorted image to obtain a second mapped image;

[0114] Performing a soft transition process on the second mapped image to obtain a processed image;

[0115] Based on the second mask noise information, the processed image is subjected to non-uniform distortion processing to obtain a second target grayscale image.

[0116] Among them, mapping the second distorted image may refer to adjusting the contrast and brightness of the second distorted image. The soft transition processing may remove the black edge of each area in the second mapped image, so that the transition between areas is soft. The second mask noise information may include second mask information and second noise information, the second mask information is used to set the area to be distorted in the processed image, and the second noise information is used to set the random degree of non-uniform distortion. The second mask noise information and the first mask noise information may be the same or different.

[0117] In this embodiment, a grayscale gradient process is performed on the internal structure image to obtain a gradient image, and based on the second noise map, an edge boundary between different pixels in the gradient image is distorted to obtain a second distorted image, and a mapping process is performed on the second distorted image to obtain a second mapped image, and a soft transition process is performed on the second mapped image to obtain a processed image, and a non-uniform distortion process is performed on the processed image to obtain a second target grayscale image, so that the texture details added to the internal structure are richer.

[0118] In some embodiments, performing non-uniform distortion processing on the processed image to obtain a second target grayscale image includes:

[0119] Performing non-uniform distortion processing on the processed image to obtain a distorted image;

[0120] Acquire a scratch texture image;

[0121] A second target grayscale image is determined based on the scratch texture image and the distortion image.

[0122] The scratch texture image refers to an image with a scratch texture. After obtaining the scratch texture image, the terminal can perform multi-distortion processing on the scratch texture image based on the moisture texture image to obtain a multi-distorted image, and then perform distortion processing on the edge boundaries between different pixels in the multi-distorted image based on the moisture texture image to obtain a third distorted image, map the pixel values ​​of the third distorted image to obtain a third mapped image, and mix the third mapped image and the distorted image to obtain a second target grayscale image.

[0123] The moisture texture image refers to an image with moisture texture. The pixel values ​​of the third distorted image are mapped to adjust the brightness and contrast of the third distorted image. The multi-distortion processing refers to the distortion processing in multiple directions.

[0124] In this embodiment, the processed image is subjected to non-uniform distortion processing to obtain a distorted image, and a scratch texture image is acquired. Based on the scratch texture image and the distorted image, a second target grayscale image is determined to further enrich the texture details added by the internal structure.

[0125] 102. Obtain a color gradient control map, and perform sampling processing on the color gradient control map to obtain color gradient control information.

[0126] The color ramp control map (Ramp Texture) refers to a map used to control the color to achieve a ramp effect. The terminal can sample the color ramp control map based on the texture coordinates of the virtual object model to obtain the color ramp control information, or the process of sampling the color ramp control map to obtain the color ramp control information can also be:

[0127] Based on the normal vector, determine the target texture coordinates;

[0128] Based on the target texture coordinates, the color gradient control map is sampled to obtain color gradient control information.

[0129] In this embodiment, the target texture coordinates are determined based on the normal vector, and the color gradient control map is sampled based on the target texture coordinates to obtain color gradient control information, thereby achieving sampling of the color gradient control map through the normal vector.

[0130] In some embodiments, based on the normal vector, the process of determining the target texture coordinates may be:

[0131] Based on the normal vector and the texture coordinates of the virtual object model, the target texture coordinates are determined.

[0132] Alternatively, based on the normal vector, the process of determining the target texture coordinates may also be:

[0133] Perform dot product between the normal vector and the camera vector to obtain the dot product result;

[0134] Based on the dot product result, the target texture coordinates are determined.

[0135] After performing a dot product on the normal vector and the camera vector, the dot product result is a scalar. The target texture coordinates are determined according to the dot product result and the preset sub-texture coordinate value. The dot product result may be a u coordinate value in the target texture coordinates, and the preset sub-texture coordinates may be a v coordinate value in the target texture coordinates.

[0136] The v coordinate value may be set according to actual conditions, for example, the v coordinate value may be a value between 0 and 1, or the v coordinate value may be a partial vertical coordinate value in the color gradient control map. This embodiment is not limited here.

[0137] In this embodiment, the dot product of the normal vector and the camera vector is performed to obtain a dot product result, and the target texture coordinates are determined based on the dot product result, so that the color gradient control map is sampled based on the target texture coordinates to obtain color gradient control information, and the color presented at the same position in the virtual object obtained based on the color gradient control information will change as the viewing angle rotates.

[0138] 103. Determine spectral color information based on the color gradient control information and the normal vector, and determine target color texture information of the target object based on the color texture information and the spectral color information.

[0139] The spectral color information refers to the basic color information having the visual effect of the target object. For example, when the visual effect of the target object is caused by the color changing effect, the spectral color information may refer to the basic color information generated by the color changing effect.

[0140] After obtaining the spectral color information, the terminal may superimpose the color texture information and the spectral color information to obtain target color texture information of the target object.

[0141] In some embodiments, based on the color gradient control information and the normal vector, the process of determining the spectral color information may be:

[0142] Based on the color gradient control information, the normal vector and the camera vector, the spectral color information is determined.

[0143] In this embodiment, spectral color information is determined based on the color gradient control information, the normal vector and the camera vector, so as to simulate the spectral color information generated when white light interferes and diffracts in the internal structure of the target object.

[0144] Wherein, based on the color gradient control information, the normal vector and the camera vector, the process of determining the spectral color information can be:

[0145] Perform dot product between the normal vector and the camera vector to obtain the dot product result;

[0146] Based on the color gradient control information and the dot product result, the spectral color information is determined.

[0147] Since the color gradient control information can be expressed in the form of numerical values, the color gradient control information and the dot product result can be multiplied to obtain the spectral color information. The dot product result can be a grayscale value. For example, the dot product result can be Figure 2 As shown in 201, the color gradient control information can be as follows Figure 2 As shown in 202, the spectral color information can be, for example, Figure 2 As shown in 203.

[0148] In this embodiment, a dot product is performed on the normal vector and the camera vector to obtain a dot product result, and the spectral color information is determined based on the color gradient control information and the dot product result to simulate the spectral color information generated when white light interferes and diffracts in the internal structure of the target object, so that the red light is the brightest and the purple light is the darkest.

[0149] In some embodiments, determining spectral color information based on the color gradient control information and the normal vector includes:

[0150] Determine candidate spectral color information based on the color gradient control information and the normal vector;

[0151] Perform a dot product of the normal vector of the virtual object model in the model space and the camera vector to obtain a first dot product result;

[0152] The candidate spectral color information is adjusted based on the first dot product result to obtain spectral color information.

[0153] The first dot product result is used to indicate the Fresnel reflection phenomenon, and the first dot product result and the candidate spectral color are multiplied to obtain spectral color information.

[0154] When the Fresnel reflection phenomenon occurs on the target object, the edge of the target object can be made to present the original color, thereby weakening the color change effect. Therefore, in this embodiment, based on the color gradient control information and the normal vector, the candidate spectral color information is determined, and the normal vector of the virtual object model in the model space and the camera vector are dot-producted to obtain a first dot product result. Based on the first dot product result, the candidate spectral color information is adjusted and processed to obtain the spectral color information, which can weaken the color change effect and make the virtual object with the visual effect of the target object obtained subsequently based on the spectral color information more realistic.

[0155] For example, when the candidate spectral color information is Figure 2 As shown in 203, the spectral color information obtained by multiplying the candidate spectral color information by the first dot product result can be as follows Figure 3 As shown, at this time, the color texture information and the spectral color information are superimposed, and the target color texture information obtained can be as follows Figure 4 shown.

[0156] Understandably, Figure 2-Figure 4 All of them represent the visual effects of virtual objects obtained after mapping various information onto the virtual object model, for example, Figure 2 201 represents the visual effect of the virtual object obtained when the dot product result is mapped to the virtual object model. Figure 2 202 represents the visual effect of the virtual object obtained when the color gradient control information is mapped to the virtual object model. Figure 2203 represents the visual effect of the virtual object obtained when the candidate spectral color information is mapped to the virtual object model. Figure 3 It represents the visual effect of the virtual object when the spectral color information is mapped to the virtual object model. Figure 4 It represents the visual effect of the virtual object when the target color texture information is mapped to the virtual object model.

[0157] In some embodiments, determining target color texture information of the target object based on the color texture information and the spectral color information includes:

[0158] Determine candidate color texture information based on the color texture information and the spectral color information;

[0159] Perform a dot product of the normal vector and the reflection vector of the virtual object model on the camera vector to obtain a second dot product result;

[0160] Based on the second dot product result and the candidate color texture information, target color texture information of the target object is determined.

[0161] The color texture information and the spectral color information may be superimposed to obtain candidate color texture information. The reflection vector refers to the vector of the camera vector reflected by the normal of the virtual object model, that is, the reflection vector is a vector determined based on the camera vector and the normal vector of the virtual object model. The normal vector and the reflection vector of the virtual object model on the camera vector are dot-producted, and the second dot-product result obtained may be a gray value.

[0162] In this embodiment, based on the color texture information and the spectral color information, the candidate color texture information is determined, and the normal vector and the reflection vector of the virtual object model to the camera vector are dot-producted to obtain a second dot product result. Based on the second dot product result and the candidate color texture information, the target color texture information of the target object is determined to achieve random dimming of the brightness of the internal structure and increase the randomness of the internal structure.

[0163] In some embodiments, determining target color texture information of the target object based on the second dot product result and the candidate color texture information includes:

[0164] Based on the second dot product result, intensity adjustment processing is performed on the candidate color texture information to obtain adjusted color texture information;

[0165] Performing enhancement processing on the adjusted color texture information to obtain enhanced color texture information;

[0166] Based on the enhanced color texture information, target color texture information of the target object is determined.

[0167] The second dot product result and the candidate color texture information can be multiplied to adjust the intensity of the candidate color texture information and obtain the adjusted color texture information. Figure 4 When shown, the adjusted color texture information can be Figure 5 shown.

[0168] The adjusted color texture information may be multiplied by itself to achieve enhancement processing of the adjusted color texture information and obtain enhanced color texture information.

[0169] In this embodiment, based on the second dot product result, the candidate color texture information is intensity adjusted to obtain adjusted color texture information, the adjusted color texture information is enhanced to obtain enhanced color texture information, and based on the enhanced color texture information, the target color texture information of the target object is determined to enhance and brighten the color of the internal structure.

[0170] After obtaining the enhanced color texture information, the terminal may determine the enhanced color texture information as the target color texture information, or the process of determining the target color texture information of the target object based on the enhanced color texture information may also be:

[0171] Perform dot product between the normal vector and the camera vector to obtain the dot product result;

[0172] Based on the dot product result and the enhanced color texture information, target color texture information of the target object is determined.

[0173] The dot product result and the enhanced color texture information may be multiplied to obtain the target color texture information. In this embodiment, the normal vector and the camera vector are dot-producted to obtain a dot product result, and the target color texture information of the target object is determined based on the dot product result and the enhanced color texture information, so as to increase the difference between the colors, so that the red color is the brightest and the purple light is the darkest.

[0174] For example, when the adjusted color texture information is Figure 5 As shown, the target color texture information can be Figure 6 shown.

[0175] 104. Obtain a noise map, and perform sampling processing on the noise map to obtain noise information.

[0176] The noise map may be a map with light and dark contrast. Optionally, the noise map may be sampled based on the texture coordinates of the virtual object model, or the noise map may be sampled to further enhance the depth and layering of the internal structure to obtain noise information, including:

[0177] Determine a second parallax effect parameter according to the camera vector and a second preset parallax depth parameter;

[0178] Determining second parallax texture coordinates based on the second parallax effect parameter and the texture coordinates of the virtual object model;

[0179] Based on the second parallax texture coordinates, the noise map is sampled to obtain noise information.

[0180] Among them, the second preset parallax depth parameter refers to a preset constant value, which can be set according to actual conditions. The second preset parallax depth parameter and the first preset parallax depth parameter may be the same or different. The second parallax effect parameter can be used to control the intensity of the parallax effect of the virtual object model. The terminal can multiply the camera vector and the second preset parallax depth parameter to obtain a second parallax effect parameter, and the second parallax effect parameter is a vector. Then, each texture coordinate of the virtual object model is subtracted from the xy value in the second parallax effect parameter to obtain a second parallax texture coordinate.

[0181] In this embodiment, a second parallax effect parameter is determined based on the camera vector and a second preset parallax depth parameter, and a second parallax texture coordinate is determined based on the second parallax effect parameter and the texture coordinates of the virtual object model. Based on the second parallax texture coordinates, the noise map is sampled and processed to obtain noise information, so that the color value at the same position in the virtual object obtained based on the noise information will change as the viewing angle rotates, thereby further improving the sense of depth and layering of the virtual object.

[0182] 105. Based on the noise information and the target color and texture information, the virtual object model is rendered to obtain a virtual object having the visual effect of the target object.

[0183] Among them, after obtaining the noise information, the terminal can multiply the noise information and the target color texture information to obtain the final texture information, map the final texture information to the virtual object model, realize the rendering of the virtual object model, and obtain a virtual object with the visual effect of the target object.

[0184] The virtual object model may refer to a three-dimensional mesh model. The virtual object refers to an element that simulates a target object through a virtual object model in a computer program. The type of the virtual object may be set according to actual conditions. For example, when the target object is a gem, the virtual object may be a virtual stone, which is a virtual stone with the visual effect of a gem. When the target object is glass, the virtual object may be a virtual glass, which is a virtual glass with the visual effect of glass. This embodiment does not limit this.

[0185] In this embodiment, by sampling the normal texture map, the color gradient control map, and the noise map three times, a virtual object with the visual effect of the target object can be obtained, and the maps required for conventional PBR materials are eliminated, thereby reducing the calculation complexity, performance consumption, and memory usage, so that a visual effect closer to the target object can be restored in the game.

[0186] For example, when the target color texture information is Figure 6 As shown in FIG. 1 , after rendering the virtual object model based on the noise information and the target color texture information, the obtained virtual object can be Figure 7 shown.

[0187] As can be seen from the above content, in an embodiment of the present application, a normal texture map of the internal structure of the target object is obtained, and the normal texture map is sampled and processed to obtain a normal vector and color texture information of the internal structure; a color gradient control map is obtained, and the color gradient control map is sampled and processed to obtain color gradient control information; based on the color gradient control information and the normal vector, the spectral color information is determined, and based on the color texture information and the spectral color information, the target color texture information of the target object is determined; a noise map is obtained, and the noise map is sampled and processed to obtain noise information; based on the noise information and the target color texture information, a virtual object model is rendered to obtain a virtual object having the visual effect of the target object, so that the virtual object can have the visual effect of the target object through three samplings, thereby reducing computational complexity and performance overhead.

[0188] According to the following Figure 8 , the model rendering method provided by the present application is further described. In this embodiment, the first noise map and the second noise map are the same noise map. The first mask noise information and the second mask noise information are the same information.

[0189] 801. A terminal obtains an internal structure image and a first noise map of a target object.

[0190] Among them, you can Fig. 9 As shown in the figure, the Cells4 node in the substance designer software is used to generate the initial internal structure image of the target object, and the safe transform node is used to transform the internal structure image to obtain the internal structure image. Fig.10 The Perlin Noise node shown in Figure 1 generates the first noise map.

[0191] 802. The terminal performs a disturbance process on the internal structure image based on the first noise map to obtain a first target grayscale image, and performs a coloring process based on the first target grayscale image to obtain a normal vector of the internal structure of the target object.

[0192] The normal vector obtained at this time is the normal vector of the world space.

[0193] Optionally, based on the first noise map, the internal structure image is disturbed to obtain a first target grayscale image, including:

[0194] Based on the first noise map, distorting the edge boundaries between different pixels in the internal structure image to obtain a first distorted image;

[0195] Performing mapping processing on the first distorted image to obtain a first mapped image;

[0196] Based on the first mask noise information, a non-uniform distortion process is performed on the first mapped image to obtain a first target grayscale image.

[0197] The first mask noise information may include first mask information and first noise information.

[0198] For example, Fig.10 As shown, the first noise map output by the Perlin Noise node is input into the Directionalwarp node, and the internal structure image output by the safe transform node is input into the Directional warp node. Through the Directional warp node, based on the first noise map, the edge boundaries between different pixels in the internal structure image are distorted to obtain a first distorted image.

[0199] The first distorted image is mapped through the Histongram Scan node to obtain a first mapped image. The first mask information and the first noise information are output through the Clouds z node. Based on the first mask noise information, the first mapped image is non-uniformly distorted through the non uniform directionalwrap node to obtain a first target grayscale image. Based on the first target grayscale image, the gradient map node is used to perform coloring to obtain the normal vector of the internal structure of the target object.

[0200] 803. The terminal adds texture details to the internal structure image based on the first noise map to obtain a second target grayscale image, and generates color texture information of the internal structure of the target object based on the second target grayscale image.

[0201] Wherein, based on the first noise map, texture details are added to the internal structure image to obtain a second target grayscale image, including:

[0202] Perform grayscale gradient processing on the internal structure image to obtain a gradient image;

[0203] Based on the first noise map, distorting the edge boundaries between different pixels in the gradient image to obtain a second distorted image;

[0204] Performing mapping processing on the second distorted image to obtain a second mapped image;

[0205] Performing a soft transition process on the second mapped image to obtain a processed image;

[0206] Based on the first mask noise information, performing non-uniform distortion processing on the processed image to obtain a distorted image;

[0207] Acquire a scratch texture image;

[0208] A second target grayscale image is determined based on the scratch texture image and the distortion image.

[0209] Among them, the scratch texture image can be multi-distorted based on the moisture texture image to obtain a multi-distorted image, and then based on the moisture texture image, the edge boundaries between different pixels in the multi-distorted image are distorted to obtain a third distorted image, the pixel values ​​of the third distorted image are mapped to obtain a third mapped image, and the third mapped image and the distorted image are mixed to obtain a second target grayscale image.

[0210] For example, you can Fig.11 As shown, Fig.11 The Perlin Noise node in Fig.10 Perlin Noise node in Fig.11 The Clouds z-node in Fig.10 The Clouds z node in . A 0-1 gradient grayscale change is assigned to each random grayscale block of the internal structure image through the Flood fill node to achieve grayscale gradient processing of the internal structure image and obtain a gradient image. Through the Directional warp node, based on the first noise map, the edge boundaries between different pixels in the gradient image are distorted to obtain a second distorted image. Through the Histongram Scan node, the second distorted image is mapped to obtain a second mapped image. Through the Distance node, the black edges of each area (each area can also be called each color block) in the second mapped image are removed to achieve a soft transition of the second mapped image and obtain a processed image. Through the non uniform directional wrap node, based on the first mask noise information, the processed image is non-uniformly distorted to obtain a distorted image.

[0211] The scratch texture image is output through the Scratchem node, the moisture texture is output through the Noisture Noise node, the scratch texture image is multi-warped based on the moisture texture image through the Multi Dir.Warp node to obtain a multi-warped image, the edge boundaries between different pixels in the multi-warped image are warped based on the moisture texture image through the Directional warp node to obtain a third warped image, the pixel values ​​of the third warped image are mapped through the Levels node to obtain a third mapped image, and the third mapped image and the warped image are blended through the Blend node to obtain a second target grayscale image.

[0212] 804. The terminal generates a normal texture map of the internal structure of the target object based on the normal direction information of the normal vector in the first direction, the normal direction information in the second direction, and the color texture information.

[0213] The terminal may first separate the normal direction information of the first direction and the normal direction information of the second direction from the normal vector, and then combine the normal direction information of the first direction, the normal direction information of the second direction and the color texture information to generate a normal texture map.

[0214] For example, Fig.12 As shown, the terminal separates the normal direction information of the first direction and the normal direction information of the second direction from the normal vector through the RGBAsplit node, and then combines the normal direction information of the first direction, the normal direction information of the second direction and the color texture information through the RGBA merge node to generate a normal texture map.

[0215] 805. The terminal determines a first parallax effect parameter according to the camera vector and a first preset parallax depth parameter, and determines a first parallax texture coordinate based on the first parallax effect parameter and the texture coordinate of the virtual object model.

[0216] If the camera vector is a world space camera vector, the camera vector is converted from the world space to the tangent space, and the tangent space camera vector is normalized, and then the normalized camera vector is multiplied by a first preset parallax depth parameter to obtain a first parallax effect parameter.

[0217] After obtaining the first parallax effect parameter, the terminal subtracts the xy values ​​in the first parallax effect parameter from the texture coordinates of the virtual object model to obtain the first parallax texture coordinates.

[0218] For example, Fig.13As shown, the texture coordinates of the virtual object model are output through the Texture Coordinate node, the texture scaling parameters are output through the Constant2Vector node, and the texture coordinates and the texture scaling parameters are multiplied through the Multiply node to obtain the scaled texture coordinates.

[0219] The camera vector in the world space is output through the Camera DirctionVector node. The camera vector and 0 are combined into a float4 vector through AppendVector. The float4 vector is converted into a camera vector in the tangent space through the TransformWorld2Tangent node. The camera vector in the tangent space is normalized through the Normalize node to obtain the normalized camera vector. The first preset parallax depth parameter is output through the Constant node. The first preset parallax depth parameter is multiplied by the adjustment parameter "-0.1" to obtain the adjusted first preset parallax depth parameter. The normalized camera vector is multiplied by the adjusted first preset parallax depth parameter through the Multiply node to obtain the first parallax effect parameter. The xy value is separated from the first parallax effect parameter through the SplitComponents node, and the xy value is converted into a two-dimensional floating point number through the MakeFloat2 node. The scaled texture coordinates and the two-dimensional floating point number are subtracted through the Subtract node to obtain the first parallax texture coordinates. The first parallax texture coordinates are stored in the variable in the RegisterLocalVar Var(opalNormallUV) node.

[0220] It is understandable that the adjustment parameter can be set according to actual conditions. The adjustment parameter is used to make the first preset parallax depth parameter a positive value and expand the adjustable range to 0-20, rather than between 0-2.

[0221] 806. The terminal samples the normal texture map based on the first parallax texture coordinates to obtain normal direction information of the internal structure in the first direction, normal direction information in the second direction, and color texture information.

[0222] 807. The terminal determines a normal vector in a third direction based on the normal vector in the first direction and the normal vector in the second direction, and determines a normal vector of an internal structure based on the normal vector in the first direction, the normal vector in the second direction, and the normal vector in the third direction.

[0223] The terminal may first adjust the normal direction information of the first direction and the normal direction information of the second direction by using the following formula to obtain the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction:

[0224] normal.rg=(texture.rg*2.0)-1.0

[0225] Among them, texture.rg represents the normal direction information of the first direction and the normal direction information of the second direction, normal.rg represents the adjusted normal direction information, and the adjusted normal direction information includes the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction.

[0226] After obtaining the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction, the terminal determines the normal direction information of the third direction based on the adjusted normal direction information of the first direction and the adjusted normal direction information of the second direction.

[0227] Specifically, the terminal may perform dot product processing on the adjusted normal direction information and itself to obtain a target dot product result, and then determine the normal direction information in the third direction based on the target dot product result.

[0228] For example, the adjusted normal direction information can be substituted into the following formula to obtain the normal direction information in the third direction:

[0229] normal.b=sqrt(max((1.0-dot(normal.rg,normal.rg)),0.0)))

[0230] Among them, normal.b represents the normal direction information in the third direction, sqrt represents the square root function, max represents the function of taking the maximum value of the two, and dot represents the dot product function.

[0231] After obtaining the normal direction information of the third direction, the terminal combines the normal direction information of the first direction, the normal direction information of the second direction and the normal direction information of the third direction to obtain the normal vector of the internal structure.

[0232] For example, Fig.14As shown, the RGB value of the normal texture map is output through the TextureSample 20 node. The R value is the normal direction information of the first direction, the G value is the normal direction information of the second direction, and the B value is the color texture information. The RGB value is adjusted through the Multiply node to obtain the adjusted RGB value. The adjusted RGB value and 1 are subtracted through the Subtract node to obtain the subtracted RGB value. The R value and G value are separated from the subtracted RGB value through the ComponentMask node. The R value is the adjusted normal direction information of the first direction, and the G value is the adjusted normal direction information of the second direction. The DotProdu The ct node performs dot product of the adjusted normal direction information and itself to obtain the target dot product result. The OneMinus node is used to subtract the target dot product result from 1 to obtain the subtraction result. The Max node is used to take the maximum value between the subtraction result and 0 to obtain the maximum value. The SquareRoot node is used to square the maximum value to obtain the normal direction information of the third direction. The SplitComponents node is used to separate the R value and the G value from the subtracted RGB value. The R value is the adjusted normal direction information of the first direction, and the G value is the adjusted normal direction information of the second direction. The Make Float3 node is used to form a normal vector with the adjusted normal direction information of the first direction, the adjusted normal direction information of the second direction, and the normal direction information of the third direction. The TransformVector node is used to switch the normal vector to the normal vector of the world space. The variable in the RegisterLocalVarVar(opalDetailNormal) node is used to store the normal vector of the world space.

[0233] 808. The terminal performs a dot product on the normal vector and the camera vector to obtain a dot product result, and determines the target texture coordinates based on the dot product result.

[0234] The dot product result may be used as the u coordinate value in the target texture coordinates, and the preset sub-texture coordinate value may be used as the v coordinate value in the target texture coordinates.

[0235] 809. The terminal samples the color gradient control map based on the target texture coordinates to obtain color gradient control information, and determines candidate spectral color information based on the color gradient control information and a dot product result.

[0236] The color gradient control information and the dot product result may be multiplied to obtain candidate spectral color information.

[0237] 8010. The terminal performs a dot product on the normal vector of the virtual object model in the model space and the camera vector to obtain a first dot product result, and adjusts the candidate spectral color information based on the first dot product result to obtain spectral color information.

[0238] The first dot product result and the candidate spectral color may be multiplied to obtain spectral color information.

[0239] 8011. The terminal determines candidate color texture information based on the color texture information and the spectral color information.

[0240] The color texture information and the spectral color information may be superimposed to obtain candidate color texture information.

[0241] 8012. The terminal performs a dot product on the normal vector and the reflection vector of the virtual object model on the camera vector to obtain a second dot product result, and based on the second dot product result, performs intensity adjustment processing on the candidate color texture information to obtain adjusted color texture information.

[0242] The second dot product result and the candidate color texture information may be multiplied to obtain the adjusted color texture information.

[0243] 8013. The terminal performs enhancement processing on the adjusted color texture information to obtain enhanced color texture information, and determines target color texture information of the target object based on the dot product result and the enhanced color texture information.

[0244] The adjusted color texture information can be multiplied by itself to achieve enhancement processing of the adjusted color texture information to obtain enhanced color texture information. The dot product result can be multiplied by the enhanced color texture information to obtain target color texture information of the target object.

[0245] 8014. The terminal determines a second parallax effect parameter according to the camera vector and the second preset parallax depth parameter, and determines a second parallax texture coordinate based on the second parallax effect parameter and the texture coordinate of the virtual object model.

[0246] 8015. The terminal samples the noise map based on the second parallax texture coordinates to obtain noise information.

[0247] 8016. The terminal renders the virtual object model based on the noise information and the target color texture information to obtain a virtual object having the visual effect of the target object.

[0248] The noise information and the target color texture information may be multiplied to obtain final texture information, and the final texture information may be mapped to the virtual object model to achieve rendering of the virtual object model and obtain a virtual object having the visual effect of the target object.

[0249] The specific implementation method and corresponding beneficial effects of this embodiment can refer to the above method embodiment, and this embodiment is not limited here.

[0250] In order to better implement the above method, an embodiment of the present application also provides a model rendering device, which can be specifically integrated into an electronic device, such as a computer device, which can be a terminal, a server, or other device.

[0251] Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer and other devices; the server can be a single server or a server cluster composed of multiple servers.

[0252] For example, in this embodiment, the method of the embodiment of the present application is described in detail by taking the model rendering device specifically integrated in the terminal as an example. This embodiment provides a model rendering device, such as Fig.15 As shown, the model rendering device may include:

[0253] The first sampling module 1501 is used to obtain the normal texture map of the internal structure of the target object, and perform sampling processing on the normal texture map to obtain the normal vector and color texture information of the internal structure.

[0254] The second sampling module 1502 is used to obtain a color gradient control map and sample the color gradient control map to obtain color gradient control information.

[0255] The information determination module 1503 is used to determine the spectral color information based on the color gradient control information and the normal vector, and to determine the target color texture information of the target object based on the color texture information and the spectral color information.

[0256] The third sampling module 1504 is used to obtain a noise map and sample the noise map to obtain noise information.

[0257] The model rendering module 1505 is used to render the virtual object model based on the noise information and the target color texture information to obtain a virtual object with the visual effect of the target object.

[0258] In some embodiments, the first sampling module 1501 is specifically used to perform:

[0259] Determining a first parallax effect parameter according to the camera vector and a first preset parallax depth parameter;

[0260] Determining first parallax texture coordinates based on the first parallax effect parameter and the texture coordinates of the virtual object model;

[0261] Based on the first parallax texture coordinates, the normal texture map is sampled to obtain the normal vector and color texture information of the internal structure.

[0262] In some embodiments, the first sampling module 1501 is specifically used to perform:

[0263] Convert the camera vector from world space to tangent space and normalize the tangent space camera vector;

[0264] The normalized camera vector is multiplied by the first preset parallax depth parameter to obtain a first parallax effect parameter.

[0265] In some embodiments, the first sampling module 1501 is specifically used to perform:

[0266] Sampling the normal texture map to obtain normal direction information of the internal structure in a first direction and normal direction information in a second direction;

[0267] Determine a normal vector in a third direction based on the normal vector in the first direction and the normal vector in the second direction;

[0268] A normal vector of the internal structure is determined based on the normal vector in the first direction, the normal vector in the second direction, and the normal vector in the third direction.

[0269] In some embodiments, the second sampling module 1502 is specifically used to:

[0270] Based on the normal vector, determine the target texture coordinates;

[0271] Based on the target texture coordinates, the color gradient control map is sampled to obtain color gradient control information.

[0272] In some embodiments, the second sampling module 1502 is specifically used to:

[0273] Perform dot product between the normal vector and the camera vector to obtain the dot product result;

[0274] Based on the dot product result, the target texture coordinates are determined.

[0275] In some embodiments, the information determination module 1503 is specifically used to:

[0276] Perform dot product between the normal vector and the camera vector to obtain the dot product result;

[0277] Based on the color gradient control information and the dot product result, the spectral color information is determined.

[0278] In some embodiments, the information determination module 1503 is specifically used to:

[0279] Determine candidate spectral color information based on the color gradient control information and the normal vector;

[0280] Perform a dot product of the normal vector of the virtual object model in the model space and the camera vector to obtain a first dot product result;

[0281] The candidate spectral color information is adjusted based on the first dot product result to obtain spectral color information.

[0282] In some embodiments, the information determination module 1503 is specifically used to:

[0283] Determine candidate color texture information based on the color texture information and the spectral color information;

[0284] Perform a dot product of the normal vector and the reflection vector of the virtual object model on the camera vector to obtain a second dot product result;

[0285] Based on the second dot product result and the candidate color texture information, target color texture information of the target object is determined.

[0286] In some embodiments, the information determination module 1503 is specifically used to:

[0287] Based on the second dot product result, intensity adjustment processing is performed on the candidate color texture information to obtain adjusted color texture information;

[0288] Performing enhancement processing on the adjusted color texture information to obtain enhanced color texture information;

[0289] Based on the enhanced color texture information, target color texture information of the target object is determined.

[0290] In some embodiments, the information determination module 1503 is specifically used to:

[0291] Perform dot product between the normal vector and the camera vector to obtain the dot product result;

[0292] Based on the dot product result and the enhanced color texture information, target color texture information of the target object is determined.

[0293] In some embodiments, the third sampling module 1504 is specifically used to:

[0294] Determine a second parallax effect parameter according to the camera vector and a second preset parallax depth parameter;

[0295] Determining second parallax texture coordinates based on the second parallax effect parameter and the texture coordinates of the virtual object model;

[0296] Based on the second parallax texture coordinates, the noise map is sampled to obtain noise information.

[0297] In some embodiments, the above apparatus further comprises:

[0298] Generate a module to execute:

[0299] Acquire the internal structure image of the target object;

[0300] Based on the internal structure image, the normal vector and color texture information of the internal structure of the target object are generated;

[0301] Based on the normal vector and color texture information, a normal texture map of the internal structure of the target object is generated.

[0302] In some embodiments, the generation module is specifically configured to perform:

[0303] Get the first noise map;

[0304] Based on the first noise map, the internal structure image is disturbed to obtain a first target grayscale image;

[0305] Coloring is performed based on the first target grayscale image to obtain a normal vector of the internal structure of the target object.

[0306] In some embodiments, the generation module is specifically configured to perform:

[0307] Get the second noise map;

[0308] Based on the second noise map, texture details are added to the internal structure image to obtain a second target grayscale image;

[0309] Based on the second target grayscale image, color texture information of the internal structure of the target object is generated.

[0310] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation methods and corresponding beneficial effects of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0311] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), or other terminal devices. Fig.16 As shown, Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1600 includes a processor 1601 having one or more processing cores, a memory 1602 having one or more computer-readable storage media, and a computer program stored in the memory 1602 and executable on the processor. The processor 1601 is electrically connected to the memory 1602. It will be understood by those skilled in the art that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange components differently.

[0312] Processor 1601 is the control center of electronic device 1600. It uses various interfaces and lines to connect various parts of the entire electronic device 1600, executes various functions of electronic device 1600 and processes data by running or loading software programs and / or modules stored in memory 1602, and calling data stored in memory 1602, thereby monitoring electronic device 1600 as a whole.

[0313] In the embodiment of the present application, the processor 1601 in the electronic device 1600 will load instructions corresponding to the processes of one or more application programs into the memory 1602 according to the following steps, and the processor 1601 will run the application programs stored in the memory 1602 to implement various functions, such as:

[0314] Obtaining a normal texture map of the internal structure of the target object, and performing sampling processing on the normal texture map to obtain the normal vector and color texture information of the internal structure;

[0315] Obtain a color gradient control map, and perform sampling processing on the color gradient control map to obtain color gradient control information;

[0316] Determine spectral color information based on the color gradient control information and the normal vector, and determine target color texture information of the target object based on the color texture information and the spectral color information;

[0317] Obtain a noise map, and perform sampling processing on the noise map to obtain noise information;

[0318] Based on the noise information and the target color and texture information, the virtual object model is rendered to obtain a virtual object with the visual effect of the target object.

[0319] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the model rendering method above, which will not be elaborated here.

[0320] Optional, such as Fig.16 As shown, the electronic device 1600 further includes: a touch screen 1603, a radio frequency circuit 1604, an audio circuit 1605, an input unit 1606, and a power supply 1607. The processor 1601 is electrically connected to the touch screen 1603, the radio frequency circuit 1604, the audio circuit 1605, the input unit 1606, and the power supply 1607, respectively. Those skilled in the art can understand that Fig.16 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0321] The touch display screen 1603 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 1603 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 electronic device, and these graphical user interfaces may be composed of graphics, text, 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-EmittingDiode) 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 1601, and can receive the command sent by the processor 1601 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 1601 to determine the type of touch event, and then the processor 1601 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 1603 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 1603 can also be used as a part of the input unit 1606 to realize the input function.

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

[0323] The audio circuit 1605 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 1605 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 1605 and converted into audio data, and then the audio data is output to the processor 1601 for processing, and then sent to another electronic device through the radio frequency circuit 1604, or the audio data is output to the memory 1602 for further processing. The audio circuit 1605 may also include an earplug jack to provide communication between an external headset and an electronic device.

[0324] The input unit 1606 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.

[0325] The power supply 1607 is used to supply power to various components of the electronic device 1600. Optionally, the power supply 1607 can be logically connected to the processor 1601 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1607 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.

[0326] although Fig.16 Not shown, the electronic device 1600 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

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

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

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

[0330] Obtaining a normal texture map of the internal structure of the target object, and performing sampling processing on the normal texture map to obtain the normal vector and color texture information of the internal structure;

[0331] Obtain a color gradient control map, and perform sampling processing on the color gradient control map to obtain color gradient control information;

[0332] Determine spectral color information based on the color gradient control information and the normal vector, and determine target color texture information of the target object based on the color texture information and the spectral color information;

[0333] Obtain a noise map, and perform sampling processing on the noise map to obtain noise information;

[0334] Based on the noise information and the target color and texture information, the virtual object model is rendered to obtain a virtual object with the visual effect of the target object.

[0335] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the model rendering method above, which will not be elaborated here.

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

[0337] Since the computer program stored in the computer-readable storage medium can execute any one of the model rendering methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the model rendering methods 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.

[0338] The above is a detailed introduction to a model rendering method, device, electronic device and computer-readable storage medium provided in the embodiments 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 ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A model rendering method, characterized in that: The method comprises: Acquire a normal texture map of the internal structure of the target object, and perform sampling processing on the normal texture map to obtain a normal vector and color texture information of the internal structure; Acquire a color gradient control map, and perform sampling processing on the color gradient control map to obtain color gradient control information; Determine spectral color information based on the color gradient control information and the normal vector, and determine target color texture information of the target object based on the color texture information and the spectral color information; Acquire a noise map, and perform sampling processing on the noise map to obtain noise information; Based on the noise information and the target color texture information, the virtual object model is rendered to obtain a virtual object having the visual effect of the target object.

2. The model rendering method according to claim 1, characterized in that: The sampling process of the normal texture map to obtain the normal vector and color texture information of the internal structure includes: Determining a first parallax effect parameter according to the camera vector and a first preset parallax depth parameter; Determining first parallax texture coordinates based on the first parallax effect parameter and the texture coordinates of the virtual object model; Based on the first parallax texture coordinates, the normal texture map is sampled to obtain the normal vector and color texture information of the internal structure.

3. The model rendering method according to claim 2, characterized in that: The determining of the first parallax effect parameter according to the camera vector and the first preset parallax depth parameter includes: Convert the camera vector from world space to tangent space, and normalize the camera vector in tangent space; The normalized camera vector is multiplied by the first preset parallax depth parameter to obtain a first parallax effect parameter.

4. The model rendering method according to claim 1, characterized in that: The sampling process of the normal texture map to obtain the normal vector of the internal structure includes: Sampling the normal texture map to obtain normal direction information of the internal structure in a first direction and normal direction information of the internal structure in a second direction; Determine a normal vector in a third direction based on the normal vector in the first direction and the normal vector in the second direction; A normal vector of the internal structure is determined based on the normal vector of the first direction, the normal vector of the second direction, and the normal vector of the third direction.

5. The model rendering method according to claim 1, characterized in that: The sampling process of the color gradient control map to obtain color gradient control information includes: Based on the normal vector, determining a target texture coordinate; Based on the target texture coordinates, the color gradient control map is sampled to obtain color gradient control information.

6. The model rendering method according to claim 5, characterized in that: The step of determining target texture coordinates based on the normal vector comprises: Perform a dot product of the normal vector and the camera vector to obtain a dot product result; Based on the dot product result, the target texture coordinates are determined.

7. The model rendering method according to claim 1, characterized in that: The determining of spectral color information based on the color gradient control information and the normal vector includes: Perform a dot product of the normal vector and the camera vector to obtain a dot product result; Spectral color information is determined based on the color gradient control information and the dot product result.

8. The model rendering method according to claim 1, characterized in that: The determining of spectral color information based on the color gradient control information and the normal vector includes: Determining candidate spectral color information based on the color gradient control information and the normal vector; Performing a dot product of a normal vector of the virtual object model in the model space and a camera vector to obtain a first dot product result; The candidate spectral color information is adjusted based on the first dot product result to obtain spectral color information.

9. The model rendering method according to claim 1, characterized in that: The step of determining target color texture information of the target object based on the color texture information and the spectral color information includes: Determining candidate color texture information based on the color texture information and the spectral color information; Performing a dot product of the normal vector and the reflection vector of the virtual object model on the camera vector to obtain a second dot product result; Based on the second dot product result and the candidate color texture information, target color texture information of the target object is determined.

10. The model rendering method according to claim 9, characterized in that: The step of determining target color texture information of the target object based on the second dot product result and the candidate color texture information includes: Based on the second dot product result, performing intensity adjustment processing on the candidate color texture information to obtain adjusted color texture information; Performing enhancement processing on the adjusted color texture information to obtain enhanced color texture information; Based on the enhanced color texture information, target color texture information of the target object is determined.

11. The model rendering method according to claim 10, characterized in that: The step of determining target color texture information of the target object based on the enhanced color texture information includes: Perform a dot product of the normal vector and the camera vector to obtain a dot product result; Based on the dot product result and the enhanced color texture information, target color texture information of the target object is determined.

12. The model rendering method according to claim 1, characterized in that: The sampling process of the noise map to obtain noise information includes: Determine a second parallax effect parameter according to the camera vector and a second preset parallax depth parameter; Determining second parallax texture coordinates based on the second parallax effect parameter and the texture coordinates of the virtual object model; Based on the second parallax texture coordinates, the noise map is sampled to obtain noise information.

13. The model rendering method according to any one of claims 1 to 12, characterized in that: Before obtaining the normal texture map of the internal structure of the target object, it also includes: Acquire an internal structure image of the target object; Based on the internal structure image, generating a normal vector and color texture information of the internal structure of the target object; A normal texture map of the internal structure of the target object is generated based on the normal vector and the color texture information.

14. The model rendering method according to claim 13, characterized in that: The step of generating a normal vector of the internal structure of the target object based on the internal structure image includes: Get the first noise map; Based on the first noise map, performing disturbance processing on the internal structure image to obtain a first target grayscale image; Coloring is performed based on the first target grayscale image to obtain a normal vector of the internal structure of the target object.

15. The model rendering method according to claim 13, characterized in that: Generating color texture information of the internal structure of the target object based on the internal structure image includes: Get the second noise map; Based on the second noise map, adding texture details to the internal structure image to obtain a second target grayscale image; Based on the second target grayscale image, color texture information of the internal structure of the target object is generated.

16. A model rendering device, characterized in that: The device comprises: A first sampling module is used to obtain a normal texture map of the internal structure of the target object, and perform sampling processing on the normal texture map to obtain a normal vector and color texture information of the internal structure; A second sampling module is used to obtain a color gradient control map and sample the color gradient control map to obtain color gradient control information; an information determination module, configured to determine spectral color information based on the color gradient control information and the normal vector, and to determine target color texture information of the target object based on the color texture information and the spectral color information; A third sampling module is used to obtain a noise map and sample the noise map to obtain noise information; The model rendering module is used to render the virtual object model based on the noise information and the target color texture information to obtain a virtual object with the visual effect of the target object.

17. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the model rendering method according to any one of claims 1 to 15.

18. 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 model rendering method according to any one of claims 1 to 15.