Exterior rendering method and apparatus for virtual object, and computer device and storage medium

By calculating the optical properties of the varnish layer and the outer surface of the virtual object, and determining the target lighting value, the problem of poor rendering effect of the virtual object's outer surface is solved, and more realistic material performance and visual improvement are achieved.

WO2024255424A1PCT designated stage expired Publication Date: 2024-12-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
PCT/CN2024/087803
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-06-12
Filing Date
2024-04-15
Publication Date
2024-12-19

AI Technical Summary

Technical Problem

The prior art is difficult to truly reflect the texture and visual effects of virtual objects in online games, resulting in poor external rendering of virtual objects.

Method used

By determining the highlight value of the varnish layer of the virtual object under the light source, obtaining the original reflection value and transmittance of the outer surface layer, determining the target lighting value based on these values, and then lighting rendering the outer layer of the virtual object to simulate the varnish texture and material characteristics.

Benefits of technology

It improves the external rendering effect of virtual objects, making it more realistically reflect the texture of the material and improves the visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024087803_19122024_PF_FP_ABST
    Figure CN2024087803_19122024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to an exterior rendering method and apparatus for a virtual object, and a computer device, a storage medium and a computer program product. The method can be applied to the fields of artificial intelligence, image processing, games, etc. The method comprises: determining a first highlight value of a varnish layer of a virtual object under a light source, wherein the varnish layer is a varnish material which covers an exterior surface layer of the virtual object (step 202); acquiring an original reflection value of the exterior surface layer and a transmittance of the varnish layer (step 204); according to the original reflection value and the transmittance, determining a reflection value and a second highlight value of the exterior surface layer under the light source (step 206); determining a target illumination value on the basis of the first highlight value, the reflection value and the second highlight value (step 208); and performing illumination rendering on an exterior of the virtual object according to the target illumination value (step 210).
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, computer equipment and storage medium for rendering exterior of virtual objects

[0001] This application claims priority to a Chinese patent application filed with the Patent Office of China on June 12, 2023, with application number 2023106877514, entitled “Method, device, computer equipment and storage medium for rendering exterior of virtual objects”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for rendering the exterior of a virtual object. Background Art

[0003] With the development of computer technology, users have increasingly demanded higher standards for the appearance of virtual objects in online games. Costumes are the external representation of virtual characters, animals, and objects in online games. Costumes can be used to dress up virtual characters, animals, and objects, meeting the diverse needs of displaying these virtual characters, animals, and objects.

[0004] In related technologies, exterior clothing is mostly made of cloth, silk, and metal, and the diversity of exterior clothing is achieved through different colors, patterns, and shapes. However, existing methods are difficult to reflect the real texture and visual effects of the exterior clothing materials, resulting in poor exterior clothing rendering effects of virtual objects.

[0005] Summary of the Invention

[0006] According to various embodiments provided in the present application, a method, apparatus, computer device, computer-readable storage medium, and computer program product for rendering the exterior of a virtual object are provided.

[0007] In a first aspect, the present application provides a method for rendering the exterior of a virtual object, which is executed by a terminal and includes:

[0008] Determine the first highlight value of the varnish layer of the virtual object under the light source; the varnish layer is the varnish material covering the exterior surface of the virtual object; obtain the original reflection value of the exterior surface and the transmittance of the varnish layer; determine the reflection value and the second highlight value of the exterior surface under the light source based on the original reflection value and the transmittance; determine the target illumination value based on the first highlight value, the reflection value and the second highlight value; and perform illumination rendering on the exterior of the virtual object according to the target illumination value.

[0009] In a second aspect, the present application also provides a device for rendering the exterior of a virtual object. The device comprises:

[0010] a varnish layer processing module, configured to determine a first highlight value of a varnish layer of a virtual object under a light source; the varnish layer is a varnish material covering an exterior surface of the virtual object;

[0011] An acquisition module, used to obtain the original reflectance value of the exterior surface and the transmittance of the varnish layer;

[0012] An exterior surface processing module, for determining a reflection value and a second highlight value of the exterior surface under a light source based on an original reflection value and a transmittance;

[0013] a target illumination value determination module, configured to determine a target illumination value based on the first highlight value, the reflection value, and the second highlight value; and

[0014] The rendering module is used to perform lighting rendering on the exterior of the virtual object according to the target lighting value.

[0015] In a third aspect, the present application further provides a computer device comprising a memory and one or more processors, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processors, the one or more processors perform the following steps:

[0016] Determine the first highlight value of the varnish layer of the virtual object under the light source; the varnish layer is the varnish material covering the exterior surface of the virtual object; obtain the original reflection value of the exterior surface and the transmittance of the varnish layer; determine the reflection value and the second highlight value of the exterior surface under the light source based on the original reflection value and the transmittance; determine the target illumination value based on the first highlight value, the reflection value and the second highlight value; and perform illumination rendering on the exterior of the virtual object according to the target illumination value.

[0017] In a fourth aspect, one or more non-volatile readable storage media have computer-readable instructions stored thereon, and when the computer-readable instructions are executed by the processor, the one or more processors implement the following steps:

[0018] Determine the first highlight value of the varnish layer of the virtual object under the light source; the varnish layer is the varnish material covering the exterior surface of the virtual object; obtain the original reflection value of the exterior surface and the transmittance of the varnish layer; determine the reflection value and the second highlight value of the exterior surface under the light source based on the original reflection value and the transmittance; determine the target illumination value based on the first highlight value, the reflection value and the second highlight value; and perform illumination rendering on the exterior of the virtual object according to the target illumination value.

[0019] In a fifth aspect, the present application further provides a computer program product, comprising computer-readable instructions, which, when executed by a processor, implement the following steps:

[0020] Determine the first highlight value of the varnish layer of the virtual object under the light source; the varnish layer is the varnish material covering the exterior surface of the virtual object; obtain the original reflection value of the exterior surface and the transmittance of the varnish layer; determine the reflection value and the second highlight value of the exterior surface under the light source based on the original reflection value and the transmittance; determine the target illumination value based on the first highlight value, the reflection value and the second highlight value; and perform illumination rendering on the exterior of the virtual object according to the target illumination value.

[0021] The details of one or more embodiments of the present application are set forth in the following drawings and description. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are merely exemplary embodiments of this application, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0023] FIG1 is a diagram illustrating an application environment of a method for rendering the exterior of a virtual object according to an embodiment;

[0024] FIG2 a is a schematic diagram of a method for rendering the exterior of a virtual object in one embodiment;

[0025] FIG2 b is a schematic flow chart of a method for rendering the exterior of a virtual object in one embodiment;

[0026] FIG3 is a schematic diagram of a related art in which the outer material is a metal material;

[0027] FIG4 is a schematic diagram of a related art in which the outer material is a combination of metal and silk materials;

[0028] FIG5 is a schematic diagram showing a virtual object having a varnish texture on its exterior from one viewing angle in one embodiment;

[0029] FIG6 is a schematic diagram showing a virtual object having a varnish texture from another perspective in one embodiment;

[0030] FIG7 is a schematic diagram of an exterior rendered without introducing an edge adjustment coefficient in one embodiment;

[0031] FIG8 is a schematic diagram of an exterior rendered when an edge adjustment coefficient is introduced in one embodiment;

[0032] FIG9 is a schematic diagram showing abnormal stretching of an exterior surface layer covered with a varnish layer in one embodiment;

[0033] FIG10 is a schematic diagram of improving abnormal stretching of an exterior surface layer covered with a varnish layer in one embodiment;

[0034] FIG11 is a schematic diagram of the overall exterior rendered when the ambient light map is not adjusted in one embodiment;

[0035] FIG12 is a schematic diagram of the overall exterior rendered when adjusting the ambient light map in one embodiment;

[0036] FIG13 is a schematic flow chart of a method for rendering the exterior of a virtual object in another embodiment;

[0037] FIG14 is a block diagram of a device for rendering an exterior of a virtual object in one embodiment;

[0038] FIG15 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0040] In this specification and the accompanying drawings, substantially the same or similar steps and elements are denoted by the same or similar reference numerals, and repeated descriptions of these steps and elements will be omitted. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance or ranking.

[0041] The method for rendering the exterior of a virtual object provided in an embodiment of the present application can be applied in the application environment shown in FIG1 . In this embodiment, a terminal 102 communicates with a server 104 via a network. A data storage system can store data that the server 104 needs to process. The data storage system can be integrated with the server 104 or placed on a cloud or other network server. The method for rendering the exterior of a virtual object can be executed by the terminal 102, by the server 104, or by the terminal 102 and the server 104 working together.

[0042] Taking the execution of the exterior rendering method of a virtual object through terminal 102 as an example, terminal 102 can determine the first highlight value of the varnish layer of the virtual object under the light source, terminal 102 can obtain the original reflection value of the exterior surface and the transmittance of the varnish layer, terminal 102 can determine the reflection value and the second highlight value of the exterior surface under the light source based on the original reflection value and the transmittance, terminal 102 can determine the target lighting value based on the first highlight value, the reflection value and the second highlight value, and terminal 102 can also perform lighting rendering on the exterior of the virtual object according to the target lighting value.

[0043] The terminal 102 may be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, IoT device, or portable wearable device. IoT device may be a smart speaker, smart TV, smart air conditioner, or smart car device. Portable wearable device may be a smart watch, smart bracelet, or head-mounted device.

[0044] The server 104 may be an independent physical server or a service node in a blockchain system. The service nodes in the blockchain system form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP).

[0045] In addition, server 104 can also be a server cluster composed of multiple physical servers, and can be 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 (CDN), and big data and artificial intelligence platforms.

[0046] The terminal 102 and the server 104 may be connected via Bluetooth, USB (Universal Serial Bus), or a network, and this application does not impose any limitation thereto.

[0047] In one embodiment, referring to FIG. 2a and FIG. 2b , a method for rendering the exterior of a virtual object is provided. The method is executed by the terminal or the server in FIG. 1 , or can be executed collaboratively by the terminal and the server in FIG. 1 . The method is described using the terminal in FIG. 1 as an example, and includes the following steps:

[0048] Step 202 : determining a first highlight value of a varnish layer of the virtual object under a light source; the varnish layer is a varnish material covering the outer surface of the virtual object.

[0049] Among them, virtual objects are different from real objects. Virtual objects are virtual character images. For example, the virtual character image can be a player character image used to represent the user in the virtual scene and controlled by the user, or it can be a non-player character image used to represent the user and interact with the user in the virtual scene. For example, virtual objects can be virtual people, virtual animals, etc.; virtual objects can also be other virtual objects in the virtual scene, for example, virtual building components (such as tables, chairs, doors, windows), virtual transportation tools (such as vehicles, ships), etc.

[0050] A virtual scene can be a scene that simulates a real environment. For example, a virtual scene can include a virtual sky, rivers, mountains, plants, animals, buildings, etc.; the virtual scene can be displayed in real time when the terminal runs a game application.

[0051] Here, "outerwear" refers to the external equipment of a virtual object, including but not limited to clothing, props, and decorations. In actual applications, the virtual object's outerwear in the virtual scene can be obtained through purchase or participation in activities. Replacing the virtual object's outerwear can change the virtual object's appearance. For example, when the virtual object is used to represent the user's player character, the virtual object's outerwear can be the virtual object's clothing. Replacing the virtual object's clothing can change the user's player character's appearance. When the virtual object is a virtual vehicle in the virtual scene, the virtual vehicle's decorations can be replaced to change the virtual vehicle's appearance.

[0052] Among them, the outer surface layer is the surface layer of the outer clothing, and the display style of the outer clothing is related to the material of the outer surface layer; the material of the outer surface layer includes but is not limited to: metal material, leather material and cloth material, and can also be a material obtained by splicing at least two materials among metal material, leather material or cloth material; for example, the outer clothing of the virtual object includes armor, and the surface material of the armor is obtained by splicing metal material and leather material, then the display style of the armor is related to the metal material and leather material.

[0053] The varnish layer covers the exterior surface, creating a visual effect that gives the exterior a varnished texture. Varnish is a coating that forms a transparent film on a material that reveals the original texture, giving the exterior a varnished texture. The varnished texture can refer to the varnished exterior having a shiny visual effect, and can also appear shimmering when viewed from a different angle.

[0054] The light source may be a direct light source; the light emitted by the direct light source comes from a light source in the virtual scene. The direct light source is different from an indirect light source, and the light emitted by the indirect light source comes from an object in the virtual scene.

[0055] The light sources in the virtual scene include but are not limited to parallel light sources and point light sources. The parallel light source can be used to simulate the sun or the moon, and the position of the point light source in the virtual scene can be the position of the camera model.

[0056] Among them, the camera model can automatically follow the virtual object in the virtual scene. When the position of the virtual object in the virtual scene changes, the camera model also changes with the position of the virtual object in the virtual environment. The camera model can be located behind the virtual object by default. The virtual object in the virtual scene can be observed from different angles through the camera model. For example, by changing the viewing angle, the virtual object can be observed from the back to the side of the virtual object.

[0057] The first highlight value refers to the highlight value generated by the light emitted by the light source on the varnish layer, and can be used to reflect the degree of specular reflection of the light emitted by the varnish layer.

[0058] In some embodiments, for a varnish layer covering the exterior surface of a virtual object, the terminal obtains the varnish layer roughness and determines the varnish layer's reflective roughness and visibility based on the varnish layer roughness. Based on the reflective roughness and visibility of the varnish layer, the terminal determines the first highlight value of the varnish layer under the light source. The reflective roughness can reflect the varnish layer's reflective effect on light, while the visibility can reflect the degree of light obstruction by the varnish layer. Calculating the first highlight value by combining the reflective roughness and visibility of the varnish layer can improve the accuracy of the first highlight value.

[0059] In some embodiments, the light source is a direct light source, and the terminal can determine the first highlight value of the varnish layer under the direct light source based on the reflective roughness and visibility of the varnish layer. It should be noted that the first highlight value is the first highlight value of the virtual object's to-be-rendered position on the varnish layer. The to-be-rendered position is a position on the exterior of the virtual object, which can be described by the coordinate system of the virtual scene. Different to-be-rendered positions may have different first highlight values ​​on the varnish layer, resulting in different degrees of specular reflection of light at different to-be-rendered positions on the varnish layer, thereby rendering the rendered varnish layer with an uneven display effect.

[0060] Step 204: Obtain the original reflectance value of the exterior surface layer and the transmittance of the varnish layer.

[0061] Among them, the original reflection value is the reflection value of the exterior surface, that is, the reflection value of the exterior surface when the exterior surface is not covered with a varnish layer; when the material of the exterior surface is a mirror material, the original reflection value can be the original reflection value generated by mirror reflection; when the material of the exterior surface is not a mirror material, the original reflection value can be the original reflection value generated by diffuse reflection.

[0062] It should be noted that the original reflection value of the exterior surface is the original reflection value of the position to be rendered on the exterior surface, and the original reflection values ​​of different positions to be rendered on the exterior surface may be different; for example, when the material of the exterior surface includes texture, the texture is an effect presented by different roughness, and the roughness of different positions to be rendered is different, resulting in different reflections of light on the exterior surface at different positions to be rendered, and thus different original reflection values ​​of different positions to be rendered on the exterior surface are different; for example, when the material of the exterior surface is a combination of mirror material and non-mirror material, the reflections of light on the exterior surface at different positions to be rendered may also be different, and thus different original reflection values ​​of different positions to be rendered on the exterior surface are different.

[0063] The transmittance of the varnish layer refers to the transmittance of the position to be rendered on the varnish layer. When the light emitted by the light source penetrates the varnish layer, it will be absorbed by the varnish layer medium, resulting in light attenuation. The transmittance of the varnish layer is used to describe the degree of attenuation of light penetrating the varnish layer. The transmittance can be used to simulate the optical effect of light penetrating the varnish layer.

[0064] In some embodiments, the terminal obtains the original reflection value of the outer surface layer, which can be determined based on the material of the outer surface layer. The embodiment of the present application does not limit the specific numerical value of the original reflection value of the outer surface layer; the terminal obtains the transmittance of the varnish layer, which can be determined based on the thickness, metallicity and color pixel value of the varnish layer; the original reflection value of the outer surface layer and the transmittance of the varnish layer are obtained to facilitate the subsequent determination of the reflection value and the second highlight value of the outer surface layer covered with the varnish layer, so that the reflection value and the second highlight value are related to the attenuation degree of light penetrating the varnish layer, thereby improving the accuracy of the reflection value and the second highlight value of the outer surface layer.

[0065] It should be noted that the obtained original reflection value and transmittance correspond to the same position to be rendered, that is, the terminal obtains the original reflection value of the position to be rendered on the exterior surface, and obtains the transmittance of the position to be rendered on the varnish layer.

[0066] Step 206 : Determine the reflection value and the second highlight value of the outer surface layer under the light source based on the original reflection value and the transmittance.

[0067] The reflectance value of the exterior surface under the light source is the reflectance value of the exterior surface when it is covered with a varnish layer. The second highlight value is the highlight value produced on the exterior surface after the light emitted by the light source passes through the varnish layer.

[0068] Since the original reflection value and transmittance correspond to the same position to be rendered, the determined reflection value is the reflection value of the position to be rendered on the outer surface, and the determined second highlight value is also the second highlight value of the position to be rendered on the outer surface.

[0069] In some embodiments, the terminal determines the reflection value of the exterior surface based on the original reflection value, the reflection intensity of the varnish layer, and the transmittance. The terminal also determines a second Fresnel coefficient for the exterior surface, and determines a second peak light value based on the second Fresnel coefficient and the transmittance. The second Fresnel coefficient reflects the ratio of reflected and transmitted light intensities when light passes through the interface of two media. The second Fresnel coefficient and the transmittance can be used to determine the intensity of light emitted by the light source after it passes through the varnish layer. Furthermore, the second peak light value of the exterior surface can be determined based on the intensity of light emitted by the light source after it passes through the varnish layer. This allows the second peak light value to be correlated with the intensity of light after it passes through the varnish layer and the degree of attenuation of light passing through the varnish layer, thereby improving the accuracy of the second peak light value.

[0070] In some embodiments, the light source is a direct light source, and the terminal can determine the reflection value and the second highlight value of the original outer layer under the light emitted by the direct light source and penetrating the varnish layer based on the original reflection value and transmittance, so that the reflection value can be used to represent the reflection value of the outer surface layer to the light emitted by the direct light source and penetrating the varnish layer, and the second highlight value can be used to represent the highlight value generated on the outer surface layer by the light emitted by the direct light source and penetrating the varnish layer, so as to facilitate subsequent rendering of the display effect of the outer surface layer under the direct light source based on the reflection value and the second highlight value.

[0071] Step 208 : Determine a target illumination value based on the first highlight value, the reflection value, and the second highlight value.

[0072] The target illumination value is a target illumination value of a position to be rendered in the exterior of the virtual object.

[0073] In some embodiments, the first highlight value is the illumination value of the varnish layer, and the terminal linearly processes the reflection value and the second highlight value to obtain the illumination value of the exterior surface layer, and linearly processes the illumination values ​​of the varnish layer and the exterior surface layer to obtain the target illumination value. It should be noted that the first highlight value, the reflection value, and the second highlight value correspond to the same location to be rendered on the exterior of the virtual object; the target illumination value is determined by combining the illumination values ​​of the varnish layer and the exterior surface layer, so that the target illumination value can reflect the illumination value obtained by combining the varnish layer and the exterior surface layer. Rendering based on the target illumination value can obtain the visual effect produced by the superposition of the varnish layer and the exterior surface layer, giving the exterior a varnish texture.

[0074] In some embodiments, the reflection value and the second highlight value are linearly processed to obtain the illumination value of the exterior surface. This can be done by adding the reflection value and the second highlight value to obtain the illumination value of the exterior surface. Alternatively, the terminal obtains a reflection weight and a highlight weight, and based on the reflection weight and the highlight weight, performs a weighted sum of the reflection value and the second highlight value to obtain the illumination value of the exterior surface. Adding the reflection value and the second highlight value can reduce the hardware resources required to determine the illumination value of the exterior surface and improve rendering efficiency. Performing a weighted sum of the reflection value and the second highlight value can bias the illumination value of the exterior surface toward the more heavily weighted of the reflection value and the second highlight value, thereby highlighting the illumination effect brought about by the more heavily weighted reflection value or the second highlight value.

[0075] In some embodiments, the illumination value of the varnish layer and the illumination value of the exterior surface layer are linearly processed to obtain a target illumination value. This can be done by adding the illumination value of the varnish layer and the illumination value of the exterior surface layer to obtain the target illumination value. Alternatively, the terminal obtains the illumination weight of the varnish layer and the illumination weight of the exterior surface layer, and performs weighted summation of the illumination value of the varnish layer and the illumination value of the exterior surface layer based on the illumination weight of the varnish layer and the illumination weight of the exterior surface layer to obtain the illumination value of the exterior surface layer and the target illumination value. Adding the illumination value of the varnish layer and the illumination value of the exterior surface layer can reduce the hardware resources required to determine the target illumination value and improve rendering efficiency. Weighted summation of the illumination value of the varnish layer and the illumination value of the exterior surface layer can make the target illumination value biased towards the one with the higher weight between the illumination value of the varnish layer and the illumination value of the exterior surface layer, thereby highlighting the illumination effect of the varnish layer or the exterior surface layer with the higher weight.

[0076] Exemplarily, the first highlight value of the position to be rendered in the varnish layer, the reflection value in the exterior surface layer, and the second highlight value are added to obtain the target illumination value of the position to be rendered.

[0077] Step 210 : Perform lighting rendering on the exterior of the virtual object according to the target lighting value.

[0078] In some embodiments, the terminal can render in a high-definition rendering pipeline using a lighting shader based on a target lighting value; the target lighting value is the target lighting value for the location to be rendered on the exterior of the virtual object. The lighting shader can calculate color pixel values ​​based on the target lighting value and display the color pixel values ​​to achieve rendering. Light rendering of the exterior of the virtual object based on the target lighting value can superimpose the highlight effect on the varnish layer, the reflection effect on the exterior surface, and the highlight effect, thereby creating a visual effect of a varnish layer covering the exterior surface, giving the exterior surface a varnish texture and enhancing the visual effect.

[0079] Because the target lighting value is the target lighting value for the locations on the exterior of the virtual object to be rendered, the terminal can render the target exterior surface layer using a lighting shader in the HD rendering pipeline based on the target lighting values ​​for each location on the exterior. The target exterior surface layer is obtained by covering the exterior surface layer with a clear coat layer. The target lighting value is determined based on the first highlight value, the reflection value, and the second highlight value. Rendering based on the target lighting value can combine the highlight effect on the clear coat layer, the reflection effect on the exterior surface layer, and the highlight effect to produce the effect of covering the exterior surface layer with a clear coat layer.

[0080] For example, referring to Figures 3 and 4, in the related art, the display style of the virtual object's outerwear is only related to the surface layer of the outerwear. For example, if the surface material of the outerwear (armor) of the virtual object in Figure 3 is metal, then the display style of the armor in Figure 3 is only related to the metal material. If the surface material of the outerwear (clothing) of the virtual object in Figure 4 is a combination of metal and silk materials, then the display style of the clothing in Figure 4 is only related to the metal and silk materials.

[0081] Referring to Figures 5 and 6, Figure 5 is the display effect from one perspective when a varnish layer is covered on the surface of the outer garment in an embodiment of the present application, and Figure 6 is the display effect from another perspective when a varnish layer is covered on the surface of the outer garment in an embodiment of the present application. It can be seen that in Figures 5 and 6, the armor (including breastplate and arm armor) and mask of the virtual object have a varnish texture; compared with the display effect of the outer garment in the related art, the outer garment rendered in the embodiment of the present application can better reflect the real texture of the outer garment material and enhance the visual effect.

[0082] In the above-mentioned method for rendering the exterior of a virtual object, for the varnish layer covering the exterior surface, the first highlight value of the varnish layer under the light source is determined, the reflection value and the second highlight value of the exterior surface under the light source are determined based on the original reflection value and the transmittance, the target illumination value is determined based on the first highlight value, the reflection value, and the second highlight value, and the exterior of the virtual object is illuminated and rendered based on the target illumination value. The highlight effect on the varnish layer, the reflection effect, and the highlight effect on the exterior surface can be superimposed to obtain a visual effect of covering the exterior surface with a varnish layer, so that the exterior surface has a varnish texture, thereby enhancing the visual effect.

[0083] In some embodiments, the light source is a direct light source; determining the first highlight value of the varnish layer of the virtual object under the light source includes: determining the reflective roughness of the varnish layer based on the roughness of the varnish layer of the virtual object, a first normal vector of the varnish layer, and a first half-angle vector of the varnish layer; determining the visibility of the varnish layer based on the roughness of the varnish layer, the first normal vector, the first sight direction vector of the varnish layer, and the light source direction vector of the direct light source; and determining the first highlight value of the varnish layer under the direct light source based on the reflective roughness, visibility, and reflective intensity of the varnish layer. Combining the reflective roughness and visibility of the varnish layer to determine the first highlight value of the varnish layer can improve the accuracy of the first highlight value.

[0084] Among them, the varnish layer roughness refers to the roughness of the position to be rendered on the varnish layer; when the varnish layer roughness of different positions to be rendered is different, the reflection effect of light at different positions to be rendered is also different, which in turn affects the first highlight value of the position to be rendered; the rougher the varnish layer (the greater the varnish layer roughness), the darker the highlight effect (the smaller the first highlight value); the smoother the varnish layer (the smaller the varnish layer roughness), the brighter the highlight effect (the larger the first highlight value).

[0085] Among them, the first normal vector of the varnish layer is the first normal vector of the position to be rendered on the varnish layer; the first normal vector of the position to be rendered will affect the first highlight value of the position to be rendered. When the first normal vectors of different selected positions are different, the first highlight values ​​of different positions to be rendered are also different, thereby making the varnish layer have a concave-convex feeling. For example, by setting the first normal vector, the varnish layer can have the effect of scratches, dents or bulges.

[0086] The light source direction vector of the direct light source is a direction vector of the light emitted by the direct light source irradiating the varnish layer, and may also be referred to as the light source direction vector of the varnish layer.

[0087] Among them, the first half-angle vector of the varnish layer is the intermediate vector between the light source direction vector of the varnish layer and the first sight direction vector. The light source direction vector of the varnish layer is the vector pointing to the direct light source at the position to be rendered on the varnish layer; the first sight direction vector is the vector pointing to the camera model at the position to be rendered on the varnish layer.

[0088] Under the influence of the roughness of the varnish layer, the varnish layer is uneven, which can be understood as the varnish layer includes many microsurfaces, and light undergoes specular reflection or refracting on each microsurface; the light is reflected or refracted on the varnish layer, which is actually specular reflection or refracting on the microsurface corresponding to the first normal vector, and the probability distribution of the first normal vector obeys the microsurface distribution function; the reflection roughness of the varnish layer can reflect the distribution of the first normal vector of the microsurface on the varnish layer, and then reflect the reflection effect of the varnish layer on light. The lower the reflection roughness, the closer the reflection effect of the varnish layer is to specular reflection, and the higher the reflection roughness, the stronger the diffuse reflection effect of the varnish layer.

[0089] When light is reflected on the varnish layer, the micro-surface of the varnish layer may block the incident light and the outgoing light. The visibility of the varnish layer can reflect the degree of light blocking by the micro-surface on the varnish layer. The higher the visibility, the higher the degree of light blocking by the micro-surface on the varnish layer, and the lower the visibility, the lower the degree of light blocking by the micro-surface on the varnish layer. The degree of light blocking by the micro-surface on the varnish layer can also affect the degree of light reflection in the varnish layer. The lower the visibility, the lower the degree of light reflection in the varnish layer, and the higher the visibility, the lower the degree of light reflection in the varnish layer.

[0090] Among them, the reflection intensity of the varnish layer is used to reflect the mirror reflection effect of the varnish layer. The greater the reflection intensity of the varnish layer, the stronger the mirror reflection effect of the varnish layer, and the smaller the reflection intensity of the varnish layer, the weaker the mirror reflection effect of the varnish layer.

[0091] In some embodiments, the terminal obtains the roughness of the varnish layer, the first normal vector and the first half-angle vector of the varnish layer at the position to be rendered on the varnish layer, and determines the normal distribution of the micro-surface corresponding to the position to be rendered in the varnish layer according to the roughness of the varnish layer, the first normal vector and the first half-angle vector of the varnish layer at the position to be rendered, so as to obtain the reflection roughness of the position to be rendered in the varnish layer; determines the visibility of the position to be rendered on the varnish layer according to the roughness of the varnish layer, the first normal vector, the first sight direction vector and the light source direction vector of the varnish layer at the position to be rendered; determines the reflectivity of the position to be rendered on the varnish layer based on the reflective roughness and visibility of the position to be rendered on the varnish layer, and determines the first highlight value of the varnish layer under direct light source according to the reflectivity and the reflection intensity of the position to be rendered on the varnish layer.

[0092] In some embodiments, before determining the reflection roughness of the varnish layer based on the varnish layer roughness of the virtual object, the first normal vector and the first half-angle vector of the varnish layer, it also includes: obtaining the roughness map of the varnish layer, obtaining the roughness of the varnish layer from the roughness map; obtaining the first normal map of the varnish layer, and obtaining the first normal vector from the first normal map.

[0093] Specifically, the roughness map stores the roughness of the varnish layer at each position to be rendered on the varnish layer. After the terminal obtains the roughness map of the varnish layer, it can obtain the roughness of the varnish layer at each position to be rendered on the varnish layer from the roughness map; the first normal map stores the first normal vector of each position to be rendered on the varnish layer. After the terminal obtains the first normal map, it can obtain the first normal vector of each position to be rendered on the varnish layer from the first normal map; the display effect of the varnish layer can be achieved by customizing the roughness map and the first normal map. For example, the roughness map and the first normal map can be designed according to the display requirements of the varnish layer to produce reflection effects, scratches, and dent effects of the varnish layer.

[0094] In the above embodiment, by determining the reflective roughness of the varnish layer, the mirror reflection effect of light in the varnish layer can be obtained, and by determining the visibility of the varnish layer, the degree to which light is blocked in the varnish layer can be obtained. By combining the reflective roughness and visibility of the varnish layer to determine the first highlight value of the varnish layer, the accuracy of the first highlight value can be improved.

[0095] In some embodiments, the reflective roughness of the varnish layer is determined based on the roughness of the varnish layer of the virtual object, the first normal vector of the varnish layer, and the first half-angle vector of the varnish layer. This includes: determining a roughness coefficient based on the roughness of the varnish layer of the virtual object; fusing the first normal vector and the first half-angle vector of the varnish layer to obtain a first fusion result; and determining the reflective roughness of the varnish layer based on the roughness coefficient and the first fusion result. The reflective roughness of the varnish layer is determined based on the roughness of the varnish layer. The reflective roughness can reflect the reflection effect of light on the varnish layer, so that the reflective effect of the varnish layer conforms to the actual texture of the varnish layer.

[0096] In some embodiments, the terminal calculates the square of the reflective roughness to obtain a candidate roughness coefficient, and calculates the square of the candidate roughness coefficient to obtain a roughness coefficient. In practical applications, the roughness coefficient can be a value between 0 and 1. The terminal fuses the first normal vector and the first half-angle vector of the varnish layer by performing a dot product of the first normal vector and the first half-angle vector; for example, the first fusion result is TopNdH, TopNdH = dot(N1, H1), where N1 is the first normal vector and H1 is the first half-angle vector.

[0097] The terminal determines a first product of the roughness coefficient and the first fusion result, determines a first difference between the first product and the first fusion result, determines a second product between the first difference and the first fusion result, and then determines the candidate roughness coefficient through the second product; the terminal calculates the square of the candidate roughness coefficient, determines the ratio between the roughness coefficient and the square of the candidate roughness coefficient, and obtains the reflective roughness of the varnish layer.

[0098] It should be noted that the roughness coefficient is the roughness coefficient of the position to be rendered on the varnish layer, the first normal vector and the first half-angle vector are both the first normal vector and the first half-angle vector of the position to be rendered on the varnish layer, and thus the first fusion result is the first fusion result corresponding to the position to be rendered on the varnish layer. The reflective roughness of the varnish layer is also the reflective roughness of the position to be rendered on the varnish layer. The reflective roughness of each position to be rendered on the exterior of the virtual object can be determined in the same manner as described above. Determining the reflective roughness based on the first normal vector and the first half-angle vector of the position to be rendered refines the rendering scale to the pixel scale of the position to be rendered, resulting in a varnish texture that is closer to reality.

[0099] In some embodiments, the terminal can process the roughness coefficient and the first fusion result through the GGX distribution function in the PBR lighting model to determine the reflection roughness of the varnish layer. PBR (Physicallly-Based Rendering) is a physical rendering technology. The GGX distribution is the Trowbridge-Reitz distribution, which can be used to render mirror reflections. The reflection roughness of the varnish layer is determined on the micro surface of the varnish layer through the GGX distribution function, so that the reflection roughness can reflect the reflection effect of the micro surface of the varnish layer on light. Directly determining the reflection roughness through the GGX distribution function can save the time required to determine the reflection roughness and improve rendering efficiency.

[0100] In the above embodiment, the first normal vector and the first half-angle vector of the varnish layer are fused, and the reflection roughness of the varnish layer is determined based on the first fusion result and the roughness coefficient obtained by the fusion. The reflection roughness can reflect the reflection effect of light on the varnish layer, so that the reflection effect of the varnish layer conforms to the real texture of the varnish layer. Subsequently, the first highlight value is determined based on the reflection roughness of the varnish layer, so that the first highlight value can reflect the degree of specular reflection of light by the varnish layer.

[0101] In some embodiments, the visibility of the varnish layer is determined based on the roughness of the varnish layer, a first normal vector, a first sight direction vector of the varnish layer, and a light source direction vector of a direct light source, including: determining a roughness coefficient based on the roughness of the varnish layer of the virtual object; fusing the first normal vector and the first sight direction vector of the varnish layer to obtain a second fusion result; fusing the first normal vector and the light source direction vector of the direct light source to obtain a third fusion result; determining the visibility of the varnish layer in the sight direction and the light source direction based on the roughness coefficient, the second fusion result, and the third fusion result; and determining the visibility of the varnish layer based on the visibility in the sight direction and the visibility in the light source direction. Determining the visibility of the varnish layer based on the roughness of the varnish layer allows the visibility to reflect the degree of light blocking by the varnish layer, and thus the reflection effect of light on the varnish layer, so that the reflection effect of the varnish layer on light is consistent with the real texture of the varnish layer.

[0102] In some embodiments, the terminal calculates the square of the reflective roughness to obtain a candidate roughness coefficient, and calculates the square of the candidate roughness coefficient to obtain a roughness coefficient. In practical applications, the roughness coefficient can be a value between 0 and 1.

[0103] The terminal performs a dot product on the first normal vector and the first sight direction vector to obtain a second fusion result, for example, TopNdV, where TopNdV = dot(N1, V1), where N1 is the first normal vector and V1 is the first sight direction vector. The terminal performs a dot product on the first normal vector and the light source direction vector of the varnish layer to obtain a third fusion result, for example, TopNdL, where TopNdL = dot(N1, L1), where N1 is the first normal vector and L1 is the light source direction vector of the varnish layer.

[0104] After obtaining the roughness coefficient, the terminal can use the first fusion method to process the roughness coefficient, the second fusion result and the third fusion result to obtain the visibility of the varnish layer in the direction of sight; use the second fusion method to process the roughness coefficient, the second fusion result and the third fusion result to obtain the visibility of the varnish layer in the direction of the light source.

[0105] It should be noted that the first fusion method is different from the second fusion method. When using the first fusion method, the first intermediate result can be determined based on the roughness coefficient and the second fusion result, and then the first intermediate result and the third fusion are fused to obtain the visibility of the varnish layer in the direction of sight; when using the second fusion method, the second intermediate result can be determined based on the roughness coefficient and the third fusion result, and then the second intermediate result and the second fusion result are fused to obtain the visibility of the varnish layer in the direction of the light source.

[0106] The terminal determines the sum of the visibility in the sight direction and the visibility in the light source direction to obtain a candidate visibility, and determines a ratio between a reference coefficient and the candidate visibility to obtain the visibility of the varnish layer. In practical applications, the reference coefficient may be 0.5.

[0107] It's important to note that the roughness coefficient, the second fusion result, and the third fusion result all represent the reflective roughness of the location to be rendered on the clearcoat layer. Consequently, the visibility of the clearcoat layer also represents the visibility of the location to be rendered on the clearcoat layer. Using the same method described above, the visibility of each location to be rendered on the exterior of a virtual object can be determined on the clearcoat layer. Determining visibility based on the roughness coefficient, the second fusion result, and the third fusion result refines the rendering scale to the pixel scale of the location to be rendered, resulting in a more realistic clearcoat texture.

[0108] In some embodiments, the visibility of the varnish layer in the direction of sight and the visibility in the direction of the light source are determined based on the roughness coefficient, the second fusion result, and the third fusion result, including: determining a second difference between the initial coefficient and the roughness coefficient; determining a third product between the second difference and the second fusion result, and determining a fourth product between the third product and the roughness coefficient; determining the product between the fourth product and the third fusion result to obtain the visibility of the varnish layer in the direction of sight; and determining the visibility of the varnish layer in the direction of the light source based on the roughness coefficient, the second difference, the second fusion result, and the third fusion result. Determining the visibility of the varnish layer in the direction of the light source using the initial coefficient, the roughness coefficient, the second fusion result, and the third fusion result improves the accuracy of the degree of light obstruction of the varnish layer in the direction of sight, so that the light reflection effect of the varnish layer conforms to the actual texture of the varnish layer.

[0109] The terminal calculates the second difference obtained by subtracting the roughness from the initial coefficient, multiplies the second difference and the second fusion result to obtain a third product, multiplies the third product and the roughness coefficient to obtain a fourth product, and multiplies the fourth product and the third fusion result to obtain the visibility of the varnish layer in the line of sight. In actual applications, the initial coefficient can be set according to needs, for example, the initial coefficient can be 1.

[0110] In some embodiments, determining the visibility of the clearcoat layer in the direction of the light source based on the roughness coefficient, the second difference, the second fusion result, and the third fusion result includes: determining a fifth product between the second difference and the third fusion result; determining a sixth product between the roughness coefficient and the fifth product; and determining the product between the sixth product and the second fusion result, to obtain the visibility of the clearcoat layer in the direction of the light source. Determining the visibility of the clearcoat layer in the direction of the light source using the initial coefficient, the roughness coefficient, the second fusion result, and the third fusion result improves the accuracy of the clearcoat layer's light obstruction in the direction of the light source, ensuring that the clearcoat layer's light reflection effect matches the clearcoat layer's realistic texture.

[0111] In some embodiments, the terminal may process the roughness coefficient, the second fusion result, and the third fusion result through the Smith function in the PBR lighting model to obtain the visibility of the varnish layer, wherein the Smith function is a shielding function that can be used to determine the degree of occlusion of the incident light and the outgoing light by the microsurface on the varnish layer, thereby determining the visibility. By using the Smith function, the visibility of the varnish layer is determined on the microsurface of the varnish layer, so that the visibility can reflect the degree of occlusion of the light by the microsurface of the varnish layer. By directly determining the visibility through the Smith function, the time required to determine the visibility can be saved, thereby improving rendering efficiency.

[0112] In the above embodiment, the first normal vector of the varnish layer and the first sight direction vector are fused to obtain a second fusion result, and the first normal vector and the light source direction vector of the varnish layer are fused to obtain a third fusion result. The visibility of the varnish layer is determined according to the roughness coefficient, the second fusion result and the second fusion result, so that the visibility can reflect the degree of light blocking by the varnish layer, and then reflect the reflection effect of light on the varnish layer, so that the reflection effect of the varnish layer on light is consistent with the real texture of the varnish layer. Subsequently, the first highlight value is determined according to the visibility of the varnish layer, so that the first highlight value can reflect the degree of specular reflection of light by the varnish layer.

[0113] In some embodiments, determining the first highlight value of the varnish layer under direct light based on the reflective roughness, visibility, and reflection intensity of the varnish layer includes: determining the reflectivity of the varnish layer based on the reflective roughness, visibility, and the first Fresnel coefficient of the varnish layer; and determining the first highlight value of the varnish layer under direct light based on the reflectivity and reflection intensity of the varnish layer. By introducing the first Fresnel coefficient, the incident angle of light affects the reflectivity, thereby improving the accuracy of the first highlight value determined based on the reflectivity.

[0114] Among them, the first Fresnel coefficient is the Fresnel coefficient of the position to be rendered on the varnish layer; the first Fresnel coefficient is used to reflect the reflection intensity of light at different incident angles. When the incident angle is large, the varnish layer performs specular reflection on the light, and when the incident angle is small, the varnish layer scatters the light. In actual rendering, the scattering of light by the varnish layer can show a rough effect.

[0115] In some embodiments, the terminal fuses the first normal vector and the light source direction vector of the varnish layer to obtain a third fusion result; determines the product between the reflection roughness, visibility and the first Fresnel coefficient of the varnish layer to obtain the reflectivity of the varnish layer; determines the reflection intensity of the varnish layer, the product between the third fusion result and the reflectivity to obtain the first highlight value of the varnish layer under direct light source.

[0116] It should be noted that the first Fresnel coefficient is the Fresnel coefficient of the position to be rendered on the varnish layer, and the reflectivity of the varnish layer determined based on the first Fresnel coefficient is the Fresnel coefficient of the position to be rendered on the varnish layer. Therefore, the first highlight value is also the first highlight value of the position to be rendered on the varnish layer. In the same way as above, the first highlight value of each position to be rendered on the exterior of the virtual object on the varnish layer can be determined.

[0117] In the above embodiment, the reflectivity of the varnish layer is determined based on the reflective roughness, visibility and the first Fresnel coefficient of the varnish layer, and the first highlight value is determined based on the reflectivity of the varnish layer. By introducing the first Fresnel coefficient, the incident angle of the light affects the reflectivity, thereby improving the accuracy of the first highlight value determined based on the reflectivity.

[0118] In some embodiments, the light source includes a direct light source; determining a reflection value and a second highlight value of the exterior surface under the light source based on an original reflection value and a transmittance includes: determining a reflection value of the exterior surface reflecting the directly transmitted light based on the original reflection value, the transmittance, and the reflection intensity of the varnish layer; the directly transmitted light is light emitted by the direct light source and transmitted through the varnish layer; determining a second Fresnel coefficient of the exterior surface based on the reflectivity corresponding to a second sight direction vector, a second half-angle vector, and a second normal vector of the exterior surface; and determining a second highlight value generated on the exterior surface by the directly transmitted light based on the transmittance and the second Fresnel coefficient. The reflection value of the exterior surface after being covered with the varnish layer is determined by combining the original reflection value, the transmittance, and the reflection intensity, thereby improving the accuracy of the reflection value; the second Fresnel coefficient can be used to reflect the ratio of reflected and transmitted light intensity when light passes through the interface of two media. Introducing the second Fresnel coefficient correlates the second highlight value with the light intensity ratio (the ratio of reflected and transmitted light intensity when light passes through the interface of two media), thereby improving the accuracy of the second highlight value.

[0119] The original reflection value is the original reflection value of the position to be rendered on the outer surface. Different positions to be rendered may have different original reflection values ​​on the outer surface. In practical applications, the original reflection value of the outer surface may be a diffuse reflection value.

[0120] The light emitted by the direct light source passes through the varnish layer and illuminates the exterior surface. The light emitted by the direct light source after passing through the varnish layer is taken as the direct transmitted light. The direct transmitted light affects the original reflection value of the exterior surface to obtain the reflection value.

[0121] Among them, the second sight direction vector is the vector pointing to the camera model at the position to be rendered on the exterior surface; the second half-angle vector is the intermediate vector between the light source direction vector of the exterior surface and the second sight direction vector. The light source direction vector of the exterior surface is used to indicate the direction in which the direct transmitted light shines on the position to be rendered on the exterior surface. The light source direction vector of the exterior surface can also be understood as the direction vector of the direct transmitted light.

[0122] Among them, the second normal vector of the exterior surface is the second normal vector of the position to be rendered on the exterior surface. The second normal vector of the position to be rendered will affect the second highlight value of the position to be rendered. When the second normal vectors of different selected positions are different, the second highlight values ​​of different positions to be rendered are also different, which can render the rough effect of the exterior surface.

[0123] The reflectivity corresponding to the second normal vector is the reflectivity in the second normal direction of the position to be rendered; and the second Fresnel coefficient is the Fresnel coefficient of the position to be rendered on the surface of the exterior.

[0124] In some embodiments, the terminal can obtain a diffuse reflection map of the exterior surface, and obtain the original reflection value of the position to be rendered on the exterior surface from the diffuse reflection map; based on the original reflection value of the position to be rendered on the exterior surface, the transmittance of the position to be rendered on the varnish layer, and the reflection intensity of the position to be rendered on the varnish layer, determine the reflection value of the position to be rendered on the exterior surface under direct transmitted light.

[0125] The terminal obtains the light source direction vector and the second sight line direction vector of the position to be rendered on the outer surface, determines the second half-angle vector according to the light source direction vector and the second sight line direction vector of the outer surface, and obtains the reflectivity corresponding to the second normal vector.

[0126] The terminal may determine the second Fresnel coefficient of the position to be rendered on the exterior surface according to the reflectivity corresponding to the second sight direction vector, the second half-angle vector and the second normal vector of the position to be rendered on the exterior surface.

[0127] The terminal obtains an initial Fresnel value of the position to be rendered on the exterior surface, where the initial Fresnel value is used to represent the Fresnel coefficient when the light is vertically incident. The terminal determines the product of the initial Fresnel value of the position to be rendered on the exterior surface, the second Fresnel coefficient, and the reflectivity in the second normal direction of the position to be rendered, and obtains the second highlight value of the position to be rendered on the exterior surface.

[0128] In the same manner as described above, the second highlight value of each position to be rendered on the outer casing of the virtual object on the outer casing surface layer can be determined.

[0129] In the above embodiment, the reflection value of the exterior surface layer for directly transmitted light is determined in combination with the original reflection value of the original exterior layer, the transmittance and reflection intensity of the varnish layer, thereby improving the accuracy of the determined reflection value of the exterior surface layer after being covered with the varnish layer; the second Fresnel coefficient is introduced so that the second highlight value is related to the ratio of the reflected light intensity and the transmitted light intensity when the light passes through the interface of two media, thereby improving the accuracy of the second highlight value; subsequently, the illumination result of the exterior surface layer under the direct light source is determined by the reflection value and the second highlight value, thereby making the rendering effect of the exterior surface layer after being covered with the varnish layer more realistic.

[0130] In some embodiments, determining a reflection value of the exterior surface layer for directly transmitted light based on the original reflection value, the transmittance, and the reflection intensity of the clearcoat layer includes: determining a candidate reflection value for the exterior surface layer based on the original reflection value, the transmittance, and the initial Fresnel value; and interpolating the original reflection value and the candidate reflection value based on the reflection intensity of the clearcoat layer to obtain a reflection value for the exterior surface layer for directly transmitted light. Interpolating the reflection value based on the reflection intensity of the clearcoat layer correlates the reflection value with the reflection intensity of the clearcoat layer, thereby improving the accuracy of the reflection value.

[0131] In some embodiments, the terminal determines the product of the reflection value, transmittance and initial Fresnel value of the position to be rendered on the exterior surface to obtain a candidate reflection value; the terminal determines the reflection intensity of the position to be rendered on the exterior surface, interpolates the original reflection value and the candidate reflection value, and obtains the reflection value of the exterior surface reflecting the directly transmitted light; that is, the reflection value is determined according to the transmittance of the varnish layer and the reflection intensity of the exterior surface, so that the reflection value can better reflect the reflection effect of the exterior surface on the light emitted by the direct light source and penetrating the varnish layer.

[0132] In some embodiments, before obtaining the original reflection value of the exterior surface layer and the transmittance of the varnish layer, it also includes: obtaining the color pixel value, metallicity and thickness of the varnish layer, determining the path distance of the light emitted by the direct light source penetrating the varnish layer based on the thickness, the first normal vector of the varnish layer, the first line of sight direction vector and the light source direction vector of the direct light source, determining the extinction coefficient based on the color pixel value, determining the light depth based on the extinction coefficient, thickness and path distance; and determining the transmittance of the varnish layer based on the light depth and the extinction coefficient.

[0133] The terminal obtains the color map of the varnish layer, and obtains the color pixel value of the position to be rendered in the varnish layer from the color map; the terminal obtains the metalness map of the varnish layer, and obtains the metalness of the position to be rendered in the varnish layer from the metalness map; the thickness is the thickness of the varnish layer, which can be set according to the exterior display effect of the virtual object.

[0134] The metallicity of the position to be rendered in the varnish layer is used as the initial extinction coefficient of the position to be rendered in the varnish layer. When the initial extinction coefficient meets the normalization condition, the thickness of the position to be rendered in the varnish layer is normalized to obtain the normalized thickness; the normalized thickness is normalized again according to the first normal vector, the first sight direction vector and the light source direction vector to obtain the path distance of the light emitted by the direct light source penetrating the varnish layer; the terminal processes the color pixel value based on the function corresponding to the Beer-Lambert law to obtain the transmission pixel value of the position to be rendered in the exterior surface layer, determines the extinction coefficient based on the transmission pixel value and the normalized thickness, and determines the light depth based on the extinction coefficient, the path distance and the normalized thickness; the terminal obtains the initial transmittance of the varnish layer at the position to be rendered; interpolates the initial transmittance and the candidate transmittance based on the initial extinction coefficient to obtain the transmittance of the varnish layer.

[0135] Among them, the normalized thickness is normalized again according to the first normal vector, the first sight direction vector and the light source direction vector to obtain the path distance of the light emitted by the direct light source penetrating the varnish layer, including fusing the first normal vector and the first sight direction vector to obtain a second fusion result, and fusing the first normal vector and the light source direction vector of the varnish layer to obtain a third fusion result; according to the second fusion result, the third fusion result and the normalized thickness, the path distance of the light emitted by the direct light source penetrating the varnish layer is determined.

[0136] Among them, the Beer-Lambert law describes the attenuation law of light when it propagates in a medium, that is, the intensity of light decreases exponentially with the increase of propagation distance.

[0137] In the above embodiment, the path distance of the light emitted by the direct light source penetrating the varnish layer is determined based on the color pixel value, metallicity and thickness of the varnish layer, the light depth is determined based on the extinction coefficient, the thickness of the varnish layer and the path distance, and the transmittance of the varnish layer is determined based on the light depth and the extinction coefficient. The transmittance of the varnish layer is used to describe the attenuation degree of light penetrating the varnish layer. Based on the transmittance, the light emitted by the direct light source and penetrating the varnish layer can be determined, thereby improving the reflection value of the exterior surface reflecting the directly transmitted light and the accuracy of the highlight value generated by the directly projected light on the exterior surface.

[0138] In some embodiments, the terminal may also process the second fusion result, the third fusion result, the color pixel value, and the metallicity of the position to be rendered in the clear coat layer using the CalcThinTransmission function in the PBR lighting model to obtain the transmittance of the position to be rendered in the clear coat layer. The CalcThinTransmission function is used to calculate interlayer transmission; directly determining the transmittance of the clear coat layer using the CalcThinTransmission function can save the time required to determine the transmittance and improve rendering efficiency.

[0139] In the above embodiment, the candidate reflection value is determined by the initial Fresnel value, the original reflection value and the transmittance of the varnish layer. The original reflection value and the candidate reflection value are interpolated according to the reflection intensity of the varnish layer to obtain the reflection value, so that the reflection value is affected by the reflection intensity of the varnish layer, thereby improving the accuracy of the reflection value. The exterior surface layer covered with the varnish layer is rendered based on the reflection value, so that the exterior surface layer covered with the varnish layer can obtain a more realistic reflection effect under direct light source.

[0140] In some embodiments, determining a second Fresnel coefficient for the exterior surface based on the reflectivity corresponding to the second sight direction vector, the second half-angle vector, and the second normal vector of the exterior surface includes: fusing the second sight direction vector and the second half-angle vector of the exterior surface to obtain a fourth fusion result; and determining the second Fresnel coefficient for the exterior surface based on the fourth fusion result and the reflectivity corresponding to the second normal vector. This improves the accuracy of the second highlight value, thereby enhancing the highlight effect of the exterior surface covered with a varnish layer under direct light.

[0141] In some embodiments, the terminal fuses the second sight direction vector and the second half-angle vector of the exterior surface by performing a dot product of the second sight direction vector and the second half-angle vector. For example, the fourth fusion result is BottomVdH, BottomVdH = dot(V2, H2), where V2 is the second sight direction vector and H2 is the second half-angle vector. The terminal can determine the second Fresnel coefficient based on the reflectivity corresponding to the fourth fusion vector and the second normal vector using a simplified Fresnel equation, as shown in Formula (1).

[0142] Formula (1): BottomF=f0+(1-f0)(1-BottomVdH) 5 ;

[0143] Among them, BottomF is the second Fresnel coefficient of the position to be rendered on the outer surface, f0 is the reflectivity corresponding to the second normal vector of the position to be rendered on the outer surface, and BottomVdH is the fourth fusion result of the position to be rendered on the outer surface.

[0144] In the above embodiment, the second Fresnel coefficient is determined according to the fourth fusion result and the reflectivity corresponding to the second normal vector, so that the second highlight value is subsequently determined based on the second Fresnel coefficient, so that the second highlight value is related to the ratio of the reflected light intensity and the transmitted light intensity when the light passes through the varnish layer and the exterior surface layer, thereby improving the accuracy of the second highlight value, and further improving the highlight effect of the exterior surface layer covered with the varnish layer under direct light source.

[0145] In some embodiments, a method for rendering exterior decoration of a virtual object includes: determining a third specular value of the varnish layer under indirect light sources based on the roughness of the varnish layer and an ambient light map of the virtual object's environment; determining a fourth specular value produced by indirect transmitted light on the exterior decoration surface based on the roughness of the exterior decoration surface of the virtual object and the ambient light map; indirect transmitted light is light emitted by an indirect light source and transmitted through the varnish layer; and determining a target illumination value based on a first specular value, a reflection value, and a second specular value, including determining the target illumination value based on the first specular value, the reflection value, the second specular value, the third specular value, and the fourth specular value. The highlight and reflection effects produced by the varnish layer and the exterior decoration surface under direct and indirect light sources are superimposed to make the texture of the varnish on the exterior decoration surface more realistic and enhance the visual effect.

[0146] Among them, the light source of the virtual environment also includes indirect light source. The light emitted by the indirect light source comes from objects in the virtual scene. For example, the light emitted by the indirect light source can be the light reflected by the object when the light emitted by the direct light source shines on the object. In practical applications, the light emitted by the indirect light source can be simulated by the ambient light map.

[0147] The first highlight value, the reflection value, and the second highlight value are determined based on the light emitted by the direct light source, and the third highlight value and the fourth highlight value are determined based on the light emitted by the indirect light source.

[0148] The exterior surface roughness is the roughness of the position to be rendered on the exterior surface, and the exterior surface roughness of different positions to be rendered is different.

[0149] The varnish layer specularly reflects light from the indirect light source, and the third specular value can be used to indicate the extent of specular reflection of the indirect light from the varnish layer. Light from the indirect light source passes through the varnish layer and illuminates the exterior surface, with the light from the indirect light source passing through the varnish layer being treated as indirect transmitted light. The exterior surface specularly reflects the indirect transmitted light, and the fourth specular value can be used to indicate the extent of specular reflection of the indirect transmitted light from the exterior surface.

[0150] In some embodiments, the terminal determines a first color pixel value of the position to be rendered in the varnish layer based on the roughness of the varnish layer and the ambient light map at the position to be rendered, and determines a third highlight value of the position to be rendered in the varnish layer under indirect light sources based on the first color pixel value and the first Fresnel coefficient at the position to be rendered. The terminal determines a second color pixel value of the position to be rendered in the exterior surface layer based on the roughness of the exterior surface layer and the ambient light map at the position to be rendered, and determines a fourth highlight value of the position to be rendered in the exterior surface layer under indirect light sources based on the second color pixel value and the second Fresnel coefficient at the position to be rendered. The highlight effect of the varnish layer under indirect light sources can be rendered using the third highlight value, and the highlight effect of the exterior surface layer under indirect light sources can be rendered using the fourth highlight value. By combining the highlight effects of the varnish layer and the exterior surface layer under direct light sources and indirect light sources, a highlight effect that is closer to reality can be obtained.

[0151] In some embodiments, the terminal performs linear processing based on the first and third highlight values ​​of the varnish layer to obtain an illumination value for the varnish layer. The terminal also performs linear processing based on the reflection value, second and fourth highlight values ​​of the exterior surface to obtain an illumination value for the exterior surface. The terminal determines a target illumination value based on the illumination value of the varnish layer and the illumination value of the exterior surface. It should be noted that the first, reflection, second, third and fourth highlight values ​​correspond to the same location to be rendered on the exterior of the virtual object. By determining the target illumination value based on the illumination value of the varnish layer and the illumination value of the exterior surface, and rendering based on the target illumination value, the display effect of the varnish layer and the display effect of the exterior surface can be superimposed to obtain a visual effect of the varnish layer covering the exterior surface, so that the exterior surface has a varnish texture.

[0152] In some embodiments, the terminal determines the illumination value under direct light source based on the first highlight value of the varnish layer, the reflection value and the second highlight value of the exterior surface layer, determines the illumination value under indirect light source based on the third highlight value of the varnish layer and the fourth highlight value of the exterior surface layer, and determines the target illumination value based on the illumination value under direct light source and the illumination value under indirect light source; similarly, the first highlight value, the reflection value, the second highlight value, the third highlight value and the fourth highlight value correspond to the same position to be rendered on the exterior of the virtual object. The target illumination value is determined based on the illumination value under direct light source and the illumination value under indirect light source, and rendering is performed based on the target illumination value. The display effect of the exterior surface layer covered with the varnish layer under direct light source can be superimposed with the display effect of the exterior surface layer covered with the varnish layer under indirect light source, so that the rendered exterior surface layer covered with the varnish layer has richer illumination performance and improved visual effect.

[0153] In the above embodiment, an indirect light source is introduced through the ambient light map, and a third highlight value obtained by specularly reflecting the light emitted by the indirect light source in the varnish layer is determined, as is a fourth highlight value obtained by specularly reflecting the indirect transmitted light on the exterior surface. The target lighting value is determined by the first highlight value, the reflection value, the second highlight value, the third highlight value, and the fourth highlight value. The highlight effects and reflection effects generated by the varnish layer and the exterior surface under direct and indirect light sources can be superimposed, and the exterior of the virtual object is rendered using the target lighting value. This can produce a visual effect of the exterior surface being covered with a varnish layer, and the texture of the varnish on the exterior surface is more realistic, thereby enhancing the visual effect.

[0154] In some embodiments, determining a third specular value of the varnish layer under indirect light sources based on the roughness of the varnish layer and an ambient light map of the virtual object's environment includes: determining a first color pixel value of the varnish layer in the ambient light map of the virtual object's environment based on the roughness of the varnish layer, a first normal vector of the varnish layer, and a first sight direction vector; and determining the third specular value of the varnish layer under indirect light sources based on the first color pixel value, an indirect light source reflectance of the varnish layer, a light intensity of the indirect light source, and a first Fresnel coefficient of the varnish layer. The third specular value can be used to render a highlight effect of the varnish layer under indirect light sources.

[0155] The ambient light map is used to represent the ambient light conditions of the exterior of the virtual object. In practical applications, the ambient light map can be constructed as a cubic ambient light map using six two-dimensional texture images of the virtual environment.

[0156] The indirect light reflectance of the varnish layer is used to represent the contribution of the indirect light source to the reflectance of the varnish layer. In practical applications, the indirect light reflectance of the varnish layer can be determined by the pre-calculated values ​​of diffuse reflection and specular reflection of the environment bidirectional reflection distribution.

[0157] In some embodiments, the terminal obtains the diffuse reflection predicted value and the pre-calculated value of the specular reflection of the environmental bidirectional reflection distribution, obtains the reflectivity corresponding to the first normal vector of the varnish layer, and determines the indirect light source reflectivity of the varnish layer according to the reflectivity corresponding to the first normal vector, the diffuse reflection predicted value and the pre-calculated value of the specular reflection of the environmental bidirectional reflection distribution; exemplarily, the indirect light source reflectivity is: f0*dfg.x+dfg.y, where f0 is the reflectivity corresponding to the first normal vector of the varnish layer, dfg.x is the weighted sum of the diffuse reflection predicted value of the environmental bidirectional reflection distribution, and dfg.y is the weighted sum of the specular reflection predicted value of the environmental bidirectional reflection distribution.

[0158] The terminal obtains the first normal vector and the first sight direction vector of the position to be rendered in the varnish layer, and determines the first reflection direction vector of the position to be rendered in the varnish layer; in actual applications, the first normal vector and the first sight direction vector of the position to be rendered in the varnish layer can be processed by the reflection function of the PBR model to obtain the first reflection direction vector of the position to be rendered in the varnish layer.

[0159] Based on the roughness of the varnish layer and the first reflected reverse vector, the terminal samples the first color pixel value of the position to be rendered in the varnish layer from the ambient light map; the terminal obtains the light intensity of the indirect light source and the first Fresnel coefficient of the position to be rendered in the varnish layer; the terminal determines the product of the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source and the first Fresnel coefficient of the varnish layer to obtain the third highlight value of the position to be rendered in the varnish layer. In the same way as above, the third highlight value of each position to be rendered in the varnish layer of the exterior of the virtual object can be obtained. It should be noted that the introduction of indirect light sources through the ambient light map increases the reflection effect of the varnish layer on the light emitted by the indirect light source. By introducing the first Fresnel coefficient, the varnish effect of the central area of ​​the exterior surface covered with the varnish layer can be improved.

[0160] In some embodiments, the exterior rendering method of a virtual object further includes: determining an edge adjustment coefficient based on a first Fresnel coefficient; determining a third highlight value of the varnish layer under an indirect light source based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, and the first Fresnel coefficient of the varnish layer; and further includes: determining the third highlight value of the varnish layer under an indirect light source based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, the first Fresnel coefficient of the varnish layer, and the edge adjustment coefficient.

[0161] Specifically, the edge adjustment coefficient may be the difference between 1 and the first Fresnel coefficient. The terminal determines the product of the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, the first Fresnel coefficient of the varnish layer, and the edge adjustment coefficient to obtain a third highlight value.

[0162] When the varnish effect is strong in the edge area of ​​the exterior surface layer covered with the varnish layer, for example, the highlight effect in the edge area is strong and it is necessary to reduce the highlight effect in the central area, an edge adjustment coefficient can be introduced, that is, the third highlight value is determined according to the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, the first Fresnel coefficient of the varnish layer and the edge adjustment coefficient, and the target illumination value is determined based on the third highlight value for rendering, which can reduce the varnish effect in the edge area.

[0163] For example, referring to Figures 7 and 8, Figure 7 shows the armor of the virtual object (including breastplate and arm armor) rendered when the edge adjustment coefficient is not introduced, and Figure 8 shows the armor of the virtual object rendered when the edge adjustment coefficient is introduced. By comparison, it can be seen that after the edge adjustment coefficient is introduced, the highlight effect of the edge area of ​​the rendered breastplate and arm armor is reduced.

[0164] In some embodiments, the specular reflection effect of the varnish layer on the ambient light can be enhanced by increasing the intensity of the ambient light (emitted by an indirect light source) and reducing the roughness of the varnish layer.

[0165] When the mirror reflection effect of the varnish layer on the ambient light is strong, it may cause abnormal stretching of the rendered exterior surface covered with the varnish layer, as shown by 901 in Figure 9; the ambient light map can be adjusted to reduce the brightness of the ground map in the virtual scene to reduce the mirror reflection effect of the varnish layer on the ambient light, thereby improving the abnormal stretching of the rendered exterior surface covered with the varnish layer. After reducing the brightness of the ground map in the virtual scene, the rendered exterior surface covered with the varnish layer is shown in Figure 10. By comparison, it can be seen that after reducing the brightness of the ground map in the virtual scene, the abnormal stretching of the rendered exterior surface covered with the varnish layer is improved, as shown by 1001 in Figure 10.

[0166] Overall, without adjusting the ambient light map, the rendering effect of the exterior is shown in Figure 11. With adjusting the ambient light map, the rendering effect of the exterior is shown in Figure 12. By comparison, the brightness of the exterior shown in Figure 11 is brighter than that shown in Figure 12. The armor in Figure 11 has abnormal stretching, while the armor in Figure 12 does not. After reducing the brightness of the ground map in the virtual scene, the abnormal stretching of the exterior surface covered with the varnish layer obtained by rendering is improved.

[0167] In the above embodiment, the first color pixel value is sampled in the ambient light map, and the third highlight value of the varnish layer under the indirect light source is determined based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source and the first Fresnel coefficient of the varnish layer. By introducing the first Fresnel coefficient, the incident angle of the light emitted by the indirect light source affects the reflection effect of the varnish layer, thereby improving the accuracy of the third highlight value and improving the highlight effect of the varnish layer under the indirect light source.

[0168] In some embodiments, determining a fourth highlight value produced on the exterior surface by indirect transmitted light based on the exterior surface roughness of the virtual object and an ambient light map includes: obtaining a second color pixel value of the exterior surface from the ambient light map based on the exterior surface roughness of the virtual object, a second sight line direction vector, and a second normal vector of the exterior surface; and determining the fourth highlight value produced on the exterior surface by indirect transmitted light based on the second color pixel value, an indirect light source reflectance of the exterior surface, a light intensity of the indirect light source, and a second Fresnel coefficient of the exterior surface. The fourth highlight value can be used to render a highlight effect of the exterior surface under the indirect light source.

[0169] Among them, the indirect light source reflectivity of the exterior surface is used to represent the contribution of the indirect light source to the reflectivity of the exterior surface. In practical applications, the indirect light source reflectivity of the exterior surface can be determined by the pre-calculated values ​​of diffuse reflection and specular reflection of the environmental bidirectional reflection distribution.

[0170] In some embodiments, the terminal obtains the predicted diffuse reflection value and the pre-calculated value of the mirror reflection of the environmental bidirectional reflection distribution, obtains the reflectivity corresponding to the second normal vector of the exterior surface, and determines the reflectivity of the indirect light source of the exterior surface based on the reflectivity corresponding to the second normal vector, the predicted diffuse reflection value and the pre-calculated value of the mirror reflection of the environmental bidirectional reflection distribution.

[0171] The terminal obtains the second normal vector and the second sight direction vector of the position to be rendered on the outer surface layer, and determines the second reflection direction vector of the position to be rendered on the outer surface layer. In actual applications, the second normal vector and the second sight direction vector of the position to be rendered on the outer surface layer can be processed by the reflection function of the PBR model to obtain the second reflection direction vector of the position to be rendered on the outer surface layer.

[0172] Based on the exterior surface roughness and the second reflection direction vector, the terminal samples the second color pixel value of the exterior surface at the location to be rendered from the ambient light map. The terminal also obtains the light intensity of the indirect light source and the second Fresnel coefficient of the exterior surface at the location to be rendered. The terminal determines the Fresnel transmission coefficient based on the second Fresnel coefficient and multiplies the second color pixel value, the indirect light reflectivity of the exterior surface, the light intensity of the indirect light source, and the Fresnel transmission coefficient to obtain the fourth highlight value of the exterior surface at the location to be rendered. The fourth highlight value of each location to be rendered on the exterior surface of the virtual object's exterior can be obtained in the same manner as described above.

[0173] The terminal determines the Fresnel transmission coefficient according to the second Fresnel coefficient, and may determine the difference between 1 and the second Fresnel coefficient to obtain the Fresnel transmission coefficient.

[0174] In the above embodiment, a second color pixel value is sampled in the ambient light map, and a fourth highlight value generated on the exterior surface by the indirect transmitted light is determined based on the second color pixel value, the reflectivity of the indirect light source of the exterior surface, the light intensity of the indirect light source, and the second Fresnel coefficient of the exterior surface, thereby improving the highlight effect of the exterior surface under the indirect light source.

[0175] In some embodiments, determining a target lighting value based on the first highlight value, the reflection value, the second highlight value, the third highlight value, and the fourth highlight value includes: determining the lighting value of the varnish layer at the location to be rendered based on the first highlight value and the third highlight value; determining the lighting value of the exterior surface layer at the location to be rendered based on the reflection value, the second highlight value, and the fourth highlight value; and determining the target lighting value for the location to be rendered based on the lighting value of the varnish layer at the location to be rendered and the lighting value of the exterior surface layer at the location to be rendered. The highlight effects and reflection effects generated by the varnish layer and the exterior surface layer under direct and indirect light sources are superimposed, and the exterior of the virtual object is rendered using the target lighting value, thereby making the varnish texture of the exterior surface layer more realistic and improving the visual effect.

[0176] In some embodiments, the terminal linearly processes the first and third highlight values ​​of the position to be rendered to obtain the illumination value of the position to be rendered on the varnish layer; the terminal linearly processes the reflection value, the second highlight value, and the fourth highlight value of the position to be rendered to obtain the illumination value of the position to be rendered on the exterior surface; the terminal linearly processes the illumination value of the position to be rendered on the varnish layer and the illumination value on the exterior surface to obtain the target illumination value of the position to be rendered. The target illumination value is determined by combining the illumination values ​​of the varnish layer and the exterior surface under direct and indirect light sources, so that the target illumination value can reflect the illumination value obtained by combining the varnish layer and the exterior surface under direct and indirect light sources. Rendering based on the target illumination value can comprehensively reflect the illumination effects of the varnish layer and the exterior surface, thereby improving the visual effect of the exterior.

[0177] In some embodiments, the terminal performs linear processing on the first highlight value and the third highlight value of the position to be rendered to obtain the illumination value of the position to be rendered on the varnish layer, which can be achieved by adding the first highlight value and the third highlight value to obtain the illumination value of the position to be rendered on the varnish layer; adding the first highlight value and the third highlight value can reduce the hardware resources required to determine the illumination value on the varnish layer and improve rendering efficiency.

[0178] The terminal performs linear processing on the first highlight value and the third highlight value of the position to be rendered to obtain the illumination value of the position to be rendered on the varnish layer. Alternatively, the terminal obtains the direct light source and the indirect light source and the weight, and performs weighted summation on the first highlight value and the third highlight value according to the direct light source and the indirect light source and the weight to obtain the illumination value of the position to be rendered on the varnish layer; the weighted summation of the first highlight value and the third highlight value is performed so that the illumination value on the varnish layer can be biased towards the one with a higher weight between the first highlight value and the third highlight value, thereby highlighting the illumination effect of the varnish layer under direct light source or indirect light source.

[0179] In some embodiments, the terminal performs linear processing on the reflection value, the second highlight value, and the fourth highlight value of the position to be rendered to obtain the illumination value of the position to be rendered on the outer surface. The processing may be to add the reflection value, the second highlight value, and the fourth highlight value of the position to be rendered to obtain the illumination value of the position to be rendered on the outer surface. Alternatively, the terminal adds the reflection value and the second highlight value to obtain a first addition result, and performs weighted summation on the first addition result and the fourth highlight value according to the direct light source and the indirect light source and the weight to obtain the illumination value of the position to be rendered on the outer surface. Adding the reflection value, the second highlight value, and the fourth highlight value can reduce the hardware resources required to determine the illumination value of the outer surface and improve rendering efficiency. Performing weighted summation on the first addition result and the fourth highlight value can make the illumination value of the outer surface biased towards the one with a higher weight between the first addition result and the fourth highlight value, thereby highlighting the illumination effect of the outer surface under direct light source or indirect light source.

[0180] The terminal linearly processes the reflection value, the second highlight value, and the fourth highlight value of the position to be rendered to obtain an illumination value of the position to be rendered on the exterior surface. Alternatively, the terminal adds the second highlight value and the fourth highlight value to obtain a second addition result, obtains a reflection weight and a highlight weight, and performs a weighted summation of the reflection value and the second addition result based on the reflection weight and the highlight weight to obtain an illumination value of the position to be rendered on the exterior surface. The weighted summation of the reflection value and the second addition result can cause the illumination value on the exterior surface to be biased toward the more heavily weighted of the reflection value and the second addition result, thereby highlighting the reflection effect or highlight effect of the exterior surface.

[0181] In some embodiments, the terminal linearly processes the illumination value of the position to be rendered on the varnish layer and the illumination value on the outer surface layer to obtain the target illumination value of the position to be rendered. The illumination value of the position to be rendered on the varnish layer and the illumination value on the outer surface layer can be added to obtain the target illumination value of the position to be rendered; or the illumination value of the position to be rendered on the varnish layer and the illumination value on the outer surface layer are weightedly summed according to the weights of the varnish layer and the outer surface layer to obtain the target illumination value of the position to be rendered.

[0182] In the above embodiment, the target illumination value is determined by the first highlight value, the reflection value, the second highlight value, the third highlight value, and the fourth highlight value. The highlight effects and reflection effects produced by the varnish layer and the exterior surface under direct light sources and indirect light sources can be superimposed. The exterior of the virtual object is rendered using the target illumination value, and the visual effect of the exterior surface being covered with a varnish layer can be obtained. The texture of the varnish on the exterior surface is more realistic, thereby enhancing the visual effect.

[0183] In some embodiments, the exterior rendering of a virtual object can be applied to a scene in which the exterior of a virtual object in a virtual scene is rendered; illustratively, the exterior surface of the virtual object is made of silk, and a varnish layer is covered on the silk to simulate the texture of the silk material in a real environment and enhance the display effect of the silk material.

[0184] The terminal determines the reflection roughness of the varnish layer according to the roughness of the varnish layer of the virtual object, the first normal vector and the first half-angle vector of the varnish layer. The terminal determines the visibility of the varnish layer based on the roughness of the varnish layer, the first normal vector, the first sight direction vector and the light source direction vector of the direct light source. The terminal determines the first highlight value of the varnish layer under the direct light source according to the reflection roughness, visibility and reflection intensity of the varnish layer.

[0185] The terminal determines the reflection value of the outer surface of the silk material reflecting direct light based on the original reflection value of the outer surface of the silk material, the transmittance and the reflection intensity of the varnish layer; determines the second Fresnel coefficient of the outer surface of the silk material based on the reflectivity corresponding to the second sight direction vector, the second half-angle vector and the second normal vector of the outer surface of the silk material; and determines the second highlight value generated by the directly transmitted light on the outer surface of the silk material based on the transmittance and the second Fresnel coefficient;

[0186] The terminal determines the third-highest light value of the varnish layer under indirect light sources based on the roughness of the varnish layer and the ambient light map of the environment in which the virtual object is located; and determines the fourth-highest light value generated by indirect transmitted light on the outer surface of the silk material based on the roughness of the outer surface of the silk material and the ambient light map.

[0187] The terminal determines a target illumination value based on the first highlight value, the reflection value, the second highlight value, the third highlight value, and the fourth highlight value.

[0188] By covering the outer surface of the silk material with a varnish layer without adding additional material types, the effect of covering the outer surface of the silk material with a varnish layer can be rendered with a small occupation of hardware resources, so that the outer surface of the silk material has a varnish texture.

[0189] In some embodiments, as shown in FIG13 , a method for rendering the exterior of a virtual object includes:

[0190] Step 1301: determining a roughness coefficient based on the roughness of the varnish layer of the virtual object; fusing a first normal vector and a first half-angle vector of the varnish layer to obtain a first fusion result; and determining the reflective roughness of the varnish layer based on the roughness coefficient and the first fusion result.

[0191] Step 1302: Fusing the first normal vector and the first sight direction vector of the clearcoat layer to obtain a second fusion result; fusing the first normal vector and the light source direction vector of the clearcoat layer to obtain a third fusion result; determining a second difference between the initial coefficient and the roughness coefficient; determining a third product between the second difference and the second fusion result, and determining a fourth product between the third product and the roughness coefficient; determining the product between the fourth product and the third fusion result to obtain visibility of the clearcoat layer in the sight direction; determining a fifth product between the second difference and the third fusion result; determining a sixth product between the roughness coefficient and the fifth product; determining the product between the sixth product and the second fusion result to obtain visibility of the clearcoat layer in the light source direction; and determining the visibility of the clearcoat layer based on the visibility in the sight direction and the visibility in the light source direction.

[0192] Step 1303: determining the reflectivity of the varnish layer based on the reflective roughness, visibility, and the first Fresnel coefficient of the varnish layer; and determining the first highlight value of the varnish layer under the direct light source based on the reflectivity of the varnish layer and the reflection intensity of the varnish layer.

[0193] Step 1304: Obtain the color pixel value, metallicity, and thickness of the clearcoat layer; determine the path distance of light emitted by the direct light source penetrating the clearcoat layer based on the thickness, the first normal vector of the clearcoat layer, the first sight direction vector, and the light direction vector of the direct light source; determine the extinction coefficient based on the color pixel value; determine the optical depth based on the extinction coefficient, thickness, and path distance; and determine the transmittance of the clearcoat layer based on the optical depth and extinction coefficient.

[0194] Step 1305: Determine a candidate reflection value for the exterior surface based on the original reflection value of the exterior surface, the transmittance of the clearcoat layer, and the initial Fresnel value; interpolate the original reflection value and the candidate reflection value based on the reflection intensity of the clearcoat layer to obtain a reflection value of the exterior surface for directly transmitted light; directly transmitted light is light emitted by a direct light source and transmitted through the clearcoat layer;

[0195] Step 1306: Fusing the second sight direction vector and the second half-angle vector of the exterior surface to obtain a fourth fusion result; determining a second Fresnel coefficient of the exterior surface based on the fourth fusion result and the reflectivity corresponding to the second normal vector; and determining a second highlight value generated on the exterior surface by the directly transmitted light based on the transmittance and the second Fresnel coefficient.

[0196] Step 1307: Determine a first color pixel value of the clearcoat layer in the ambient light map of the virtual object's environment based on the clearcoat layer's roughness, the clearcoat layer's first normal vector, and the first viewing direction vector; determine an edge adjustment coefficient based on the first Fresnel coefficient; and determine a third highlight value of the clearcoat layer under the indirect light source based on the first color pixel value, the clearcoat layer's indirect light source reflectance, the indirect light source's intensity, the clearcoat layer's first Fresnel coefficient, and the edge adjustment coefficient.

[0197] Step 1308: Based on the roughness of the exterior surface of the virtual object, the second sight direction vector and the second normal vector of the exterior surface, obtain a second color pixel value of the exterior surface in the ambient light map; and determine a fourth highlight value generated on the exterior surface by the indirect transmitted light based on the second color pixel value, the indirect light source reflectivity of the exterior surface, the light intensity of the indirect light source, and the second Fresnel coefficient of the exterior surface; the indirect transmitted light is light emitted by the indirect light source and transmitted through the varnish layer.

[0198] Step 1309: Determine the illumination value of the position to be rendered on the varnish layer based on the first and third highlight values; determine the illumination value of the position to be rendered on the exterior surface layer based on the reflection value, the second and fourth highlight values; and determine the target illumination value of the position to be rendered based on the illumination value of the position to be rendered on the varnish layer and the illumination value of the position to be rendered on the exterior surface layer.

[0199] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0200] In the above-mentioned method for rendering the exterior of a virtual object, for the varnish layer covering the exterior surface, the first highlight value of the varnish layer under the light source is determined, the reflection value and the second highlight value of the exterior surface under the light source are determined based on the original reflection value and the transmittance, the target illumination value is determined based on the first highlight value, the reflection value, and the second highlight value, and the exterior of the virtual object is illuminated and rendered based on the target illumination value. The highlight effect on the varnish layer, the reflection effect, and the highlight effect on the exterior surface can be superimposed to obtain a visual effect of covering the exterior surface with a varnish layer, so that the exterior surface has a varnish texture, thereby enhancing the visual effect.

[0201] Based on the same inventive concept, embodiments of the present application also provide a virtual object exterior rendering device for implementing the aforementioned virtual object exterior rendering method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of the embodiments of the virtual object exterior rendering device provided below can be referenced to the limitations of the virtual object exterior rendering method described above.

[0202] In one embodiment, as shown in FIG14 , a device for rendering exterior decoration of a virtual object is provided, comprising: a varnish layer processing module 1401 , an acquisition module 1402 , an exterior surface layer processing module 1403 , a target illumination value determination module 1404 , and a rendering module 1405 , wherein:

[0203] The varnish layer processing module 1401 is used to determine the first highlight value of the varnish layer of the virtual object under the light source; the varnish layer is the varnish material covering the outer surface of the virtual object;

[0204] An acquisition module 1402 is used to obtain the original reflectance value of the exterior surface layer and the transmittance of the varnish layer;

[0205] The exterior surface processing module 1403 is used to determine the reflection value and the second highlight value of the exterior surface under the light source based on the original reflection value and the transmittance;

[0206] A target illumination value determination module 1404 is configured to determine a target illumination value based on the first highlight value, the reflection value, and the second highlight value;

[0207] The rendering module 1405 is configured to perform lighting rendering on the exterior of the virtual object according to the target lighting value.

[0208] In some embodiments, the light source is a direct light source, and the varnish layer processing module 1401 includes:

[0209] a reflection roughness determination unit, configured to determine the reflection roughness of the varnish layer based on the varnish layer roughness of the virtual object, a first normal vector and a first half-angle vector of the varnish layer;

[0210] a visibility determining unit for determining the visibility of the clearcoat layer based on the roughness of the clearcoat layer, the first normal vector, the first sight direction vector of the clearcoat layer, and the light source direction vector of the direct light source;

[0211] The first highlight value determining unit is used to determine the first highlight value of the varnish layer under the direct light source based on the reflection roughness, visibility and reflection intensity of the varnish layer.

[0212] In some embodiments, the reflection roughness determination unit is also used to determine the roughness coefficient based on the roughness of the varnish layer of the virtual object; fuse the first normal vector and the first half-angle vector of the varnish layer to obtain a first fusion result; and determine the reflection roughness of the varnish layer based on the roughness coefficient and the first fusion result.

[0213] In some embodiments, the visibility determination unit is also used to determine the roughness coefficient based on the roughness of the varnish layer of the virtual object; fuse the first normal vector and the first sight direction vector of the varnish layer to obtain a second fusion result; fuse the first normal vector and the light source direction vector of the varnish layer to obtain a third fusion result; determine the visibility of the varnish layer in the sight direction and the visibility in the light source direction based on the roughness coefficient, the second fusion result and the third fusion result; determine the visibility of the varnish layer based on the visibility in the sight direction and the visibility in the light source direction.

[0214] In some embodiments, the visibility determination unit is also used to determine a second difference between the initial coefficient and the roughness coefficient; determine a third product between the second difference and the second fusion result, and determine a fourth product between the third product and the roughness coefficient; determine the product between the fourth product and the third fusion result to obtain the visibility of the varnish layer in the line of sight direction; and determine the visibility of the varnish layer in the direction of the light source based on the roughness coefficient, the second difference, the second fusion result and the third fusion result.

[0215] In some embodiments, the visibility determination unit is also used to determine the fifth product between the second difference and the third fusion result; determine the sixth product between the roughness coefficient and the fifth product; and determine the product between the sixth product and the second fusion result to obtain the visibility of the varnish layer in the direction of the light source.

[0216] In some embodiments, the first highlight value determination unit is also used to determine the reflectivity of the varnish layer based on the reflection roughness, visibility and the first Fresnel coefficient of the varnish layer; and determine the first highlight value of the varnish layer under direct light source based on the reflectivity of the varnish layer and the reflection intensity of the varnish layer.

[0217] In some embodiments, the light source includes a direct light source, and the exterior surface processing module 1403 includes a reflection value determination unit, a second Fresnel coefficient determination unit, and a second highlight value determination unit;

[0218] a reflection value determining unit for determining a reflection value of the exterior surface layer reflecting direct transmitted light based on the original reflection value, the transmittance, and the reflection intensity of the varnish layer; the direct transmitted light being light emitted by the direct light source and transmitted through the varnish layer;

[0219] a second Fresnel coefficient determining unit, configured to determine a second Fresnel coefficient of the exterior surface layer based on a reflectivity corresponding to a second sight line direction vector, a second half-angle vector, and a second normal vector of the exterior surface layer;

[0220] The second highlight value determining unit is configured to determine a second highlight value generated on the outer surface layer by the directly transmitted light based on the transmittance and the second Fresnel coefficient.

[0221] In some embodiments, the reflection value determination unit is further used to determine a candidate reflection value of the exterior surface based on the original reflection value, transmittance and initial Fresnel value; and interpolate the original reflection value and the candidate reflection value according to the reflection intensity of the varnish layer to obtain the reflection value of the exterior surface reflecting the directly transmitted light.

[0222] In some embodiments, the second Fresnel coefficient determination unit is further used to fuse the second sight direction vector and the second half-angle vector of the exterior surface to obtain a fourth fusion result; and determine the second Fresnel coefficient of the exterior surface based on the fourth fusion result and the reflectivity corresponding to the second normal vector.

[0223] In some embodiments, the exterior rendering device of the virtual object also includes: a transmittance determination module, which is used to obtain the color pixel value, metallicity and thickness of the varnish layer; determine the path distance of the light emitted by the direct light source penetrating the varnish layer based on the thickness, the first normal vector of the varnish layer, the first sight direction vector and the light source direction vector of the direct light source; determine the extinction coefficient based on the color pixel value; determine the optical depth based on the extinction coefficient, thickness and path distance; and determine the transmittance of the varnish layer based on the optical depth and the extinction coefficient.

[0224] In some embodiments, the apparatus for rendering exterior decoration of a virtual object further includes: an indirect light source processing module configured to determine a third specular value of the varnish layer under indirect light source based on the roughness of the varnish layer and an ambient light map of the environment in which the virtual object is located; and to determine a fourth specular value generated by indirect transmitted light on the exterior decoration surface layer based on the roughness of the exterior decoration surface layer of the virtual object and the ambient light map; the indirect transmitted light being light emitted by the indirect light source and transmitted through the varnish layer;

[0225] Accordingly, the target illumination value determination module 1404 is configured to determine the target illumination value based on the first highlight value, the reflection value, the second highlight value, the third highlight value, and the fourth highlight value.

[0226] In some embodiments, the indirect light source processing module includes: a third highlight value determination unit, which is used to determine the first color pixel value of the varnish layer in the ambient light map of the environment in which the virtual object is located based on the roughness of the varnish layer, the first normal vector of the varnish layer, and the first line of sight direction vector; and determine the third highlight value of the varnish layer under the indirect light source based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, and the first Fresnel coefficient of the varnish layer.

[0227] In some embodiments, the indirect light source processing module also includes: an edge adjustment coefficient determination module, used to determine the edge adjustment coefficient based on the first Fresnel coefficient; a third highlight value determination unit, also used to determine the third highlight value of the varnish layer under the indirect light source based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, the first Fresnel coefficient of the varnish layer and the edge adjustment coefficient.

[0228] In some embodiments, the indirect light source processing module includes: a fourth highlight value determination unit, which is used to obtain a second color pixel value of the exterior surface in the ambient light map based on the roughness of the exterior surface of the virtual object, the second sight direction vector and the second normal vector of the exterior surface; and determine the fourth highlight value generated by the indirect transmitted light on the exterior surface based on the second color pixel value, the indirect light source reflectivity of the exterior surface, the light intensity of the indirect light source and the second Fresnel coefficient of the exterior surface.

[0229] In some embodiments, the target illumination value determination module 1404 is further used to determine the illumination value of the position to be rendered on the varnish layer based on the first highlight value and the third highlight value; determine the illumination value of the position to be rendered on the exterior surface layer based on the reflection value, the second highlight value and the fourth highlight value; and determine the target illumination value of the position to be rendered based on the illumination value of the position to be rendered on the varnish layer and the illumination value of the position to be rendered on the exterior surface layer.

[0230] Each module in the aforementioned virtual object exterior rendering device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor within a computer device in the form of hardware, or may be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0231] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in Figure 15. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, it implements a method for rendering the exterior of a virtual object. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0232] Those skilled in the art will understand that the structure shown in FIG15 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0233] In one embodiment, a computer device is provided, including a memory and one or more processors. The memory stores computer-readable instructions, which, when executed by the processors, enable the one or more processors to implement the above-mentioned method for rendering the exterior of a virtual object.

[0234] In one embodiment, one or more non-volatile readable storage media are provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by the processor, the one or more processors implement the above-mentioned method for rendering the exterior of a virtual object.

[0235] In one embodiment, a computer program product is provided, including a computer program and computer-readable instructions, which implement the above-mentioned method for rendering the exterior of a virtual object when executed by a processor.

[0236] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.

[0237] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.

[0238] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0239] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A method for rendering the exterior of a virtual object, wherein: Applied to a terminal, the method comprises: Determine a first highlight value of a varnish layer of a virtual object under a light source, wherein the varnish layer is a varnish material covering an outer surface layer of the virtual object; Obtaining the original reflection value of the exterior surface layer and the transmittance of the varnish layer; Determining the reflection value and the second highlight value of the outer surface layer under the light source according to the original reflection value and the transmittance; determining a target illumination value based on the first highlight value, the reflection value, and the second highlight value; and The exterior of the virtual object is illuminated and rendered according to the target illumination value.

2. The method according to claim 1, wherein: The light source is a direct light source, and determining the first highlight value of the varnish layer of the virtual object under the light source includes: Determining the reflection roughness of the varnish layer based on the varnish layer roughness of the virtual object, the first normal vector and the first half-angle vector of the varnish layer; Determining the visibility of the clear varnish layer based on the roughness of the clear varnish layer, the first normal vector, the first sight direction vector of the clear varnish layer, and the light source direction vector of the direct light source; and A first highlight value of the varnish layer under the direct light source is determined based on the reflective roughness, the visibility, and the reflective intensity of the varnish layer.

3. The method according to claim 2, wherein: The method of determining the reflection roughness of the varnish layer based on the varnish layer roughness of the virtual object, the first normal vector and the first half-angle vector of the varnish layer comprises: determining a roughness coefficient based on the roughness of the varnish layer of the virtual object; Fusing the first normal vector and the first half-angle vector of the clear coat layer to obtain a first fusion result; and Based on the roughness coefficient and the first fusion result, the reflective roughness of the varnish layer is determined.

4. The method according to claim 2 or 3, wherein: The determining the visibility of the clear varnish layer based on the roughness of the clear varnish layer, the first normal vector, the first sight direction vector of the clear varnish layer, and the light source direction vector of the direct light source comprises: determining a roughness coefficient based on the roughness of the varnish layer of the virtual object; fusing the first normal vector and the first sight direction vector of the varnish layer to obtain a second fusion result; Performing fusion processing on the first normal vector and the light source direction vector of the direct light source to obtain a third fusion result; Determining the visibility of the varnish layer in the sight direction and the visibility in the light source direction based on the roughness coefficient, the second fusion result and the third fusion result; and The visibility of the clearcoat layer is determined based on the visibility in the sight direction and the visibility in the light source direction.

5. The method according to claim 4, wherein: The determining, based on the roughness coefficient, the second fusion result and the third fusion result, the visibility of the varnish layer in the sight direction and the visibility in the light source direction, comprises: determining a second difference between the initial coefficient and the roughness coefficient; determining a third product between the second difference and the second fusion result, determining a fourth product between the third product and the roughness coefficient; Determine the product between the fourth product and the third fusion result to obtain the visibility of the varnish layer in the sight direction; and The visibility of the varnish layer in the direction of the light source is determined based on the roughness coefficient, the second difference, the second fusion result and the third fusion result.

6. The method according to claim 5, wherein: The determining the visibility of the varnish layer in the direction of the light source based on the roughness coefficient, the second difference, the second fusion result and the third fusion result comprises: determining a fifth product between the second difference and the third fusion result; determining a sixth product between the roughness coefficient and the fifth product; and The product between the sixth product and the second fusion result is determined to obtain the visibility of the varnish layer in the direction of the light source.

7. The method according to any one of claims 2 to 6, wherein: The step of determining a first highlight value of the varnish layer under the direct light source based on the reflective roughness, the visibility, and the reflective intensity of the varnish layer comprises: Determining a reflectivity of the clearcoat layer based on the reflective roughness, the visibility, and a first Fresnel coefficient of the clearcoat layer; and A first highlight value of the clear varnish layer under the direct light source is determined based on the reflectivity of the clear varnish layer and the reflection intensity of the clear varnish layer.

8. The method according to any one of claims 1 to 7, wherein: The light source includes a direct light source, and determining the reflection value and the second highlight value of the outer surface layer under the light source according to the original reflection value and the transmittance includes: determining a reflection value of the exterior surface layer reflecting direct transmitted light based on the original reflection value, the transmittance, and the reflection intensity of the clear varnish layer, the direct transmitted light being light emitted by the direct light source and transmitting through the clear varnish layer; Determining a second Fresnel coefficient of the exterior surface layer based on a reflectivity corresponding to a second sight line direction vector, a second half-angle vector, and a second normal vector of the exterior surface layer; and Based on the transmittance and the second Fresnel coefficient, a second highlight value generated on the exterior surface layer by the direct transmitted light is determined.

9. The method according to claim 8, wherein: The determining, based on the original reflection value, the transmittance and the reflection intensity of the varnish layer, a reflection value of the outer surface layer reflecting the directly transmitted light comprises: Determining a candidate reflectance value for the exterior surface based on the original reflectance value, the transmittance, and an initial Fresnel value; and The original reflection value and the candidate reflection value are interpolated according to the reflection intensity of the varnish layer to obtain the reflection value of the outer surface layer reflecting the directly transmitted light.

10. The method according to claim 8 or 9, wherein: The determining of the second Fresnel coefficient of the outer surface layer based on the reflectivity corresponding to the second sight direction vector, the second half-angle vector and the second normal vector of the outer surface layer comprises: Performing fusion processing on the second sight direction vector and the second half-angle vector of the outer surface layer to obtain a fourth fusion result; and A second Fresnel coefficient of the exterior surface layer is determined based on the fourth fusion result and the reflectivity corresponding to the second normal vector.

11. The method according to any one of claims 1 to 10, wherein: Before obtaining the original reflection value of the outer surface layer and the transmittance of the varnish layer, the method further includes: Obtaining the color pixel value, metalness and thickness of the varnish layer; Determine a path distance of light emitted by the direct light source penetrating the varnish layer according to the thickness, a first normal vector of the varnish layer, a first sight direction vector, and a light source direction vector of the direct light source; determining an extinction coefficient based on the color pixel value; determining an optical depth based on the extinction coefficient, the thickness, and the path distance; and Based on the optical depth and the extinction coefficient, the transmittance of the varnish layer is determined.

12. The method according to any one of claims 1 to 11, wherein: The method further comprises: Based on the roughness of the varnish layer and the ambient light map of the environment where the virtual object is located, determine the varnish layer under the indirect light source The third highlight value below; determining, based on the roughness of the outer surface layer of the virtual object and the ambient light map, a fourth highlight value generated by indirect transmission light on the outer surface layer, wherein the indirect transmission light is light emitted by the indirect light source and transmitted through the varnish layer; The determining of a target illumination value based on the first highlight value, the reflection value, and the second highlight value comprises: A target lighting value is determined based on the first highlight value, the reflection value, the second highlight value, the third highlight value, and the fourth highlight value.

13. The method according to claim 12, wherein: The determining, based on the roughness of the varnish layer and the ambient light map of the environment in which the virtual object is located, the third highlight value of the varnish layer under the indirect light source comprises: Determining a first color pixel value of the varnish layer in an ambient light map of the environment where the virtual object is located based on the roughness of the varnish layer, a first normal vector of the varnish layer, and a first sight direction vector; and A third highlight value of the varnish layer under the indirect light source is determined based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source and the first Fresnel coefficient of the varnish layer.

14. The method according to claim 13, wherein: The method further comprises: Determining an edge adjustment coefficient according to the first Fresnel coefficient; The method of determining a third highlight value of the varnish layer under the indirect light source based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source and the first Fresnel coefficient of the varnish layer further includes: A third highlight value of the varnish layer under the indirect light source is determined based on the first color pixel value, the indirect light source reflectivity of the varnish layer, the light intensity of the indirect light source, the first Fresnel coefficient of the varnish layer and the edge adjustment coefficient.

15. The method according to any one of claims 12 to 14, wherein: The determining, based on the roughness of the outer surface of the virtual object and the ambient light map, a fourth highlight value generated by the indirect transmitted light on the outer surface, comprises: Based on the roughness of the outer surface of the virtual object, the second sight direction vector and the second normal vector of the outer surface, acquiring a second color pixel value of the outer surface in the ambient light map; and A fourth highlight value generated on the exterior surface layer by the indirect transmitted light is determined based on the second color pixel value, the indirect light source reflectivity of the exterior surface layer, the light intensity of the indirect light source, and the second Fresnel coefficient of the exterior surface layer.

16. The method according to any one of claims 12 to 15, wherein: The determining of the target illumination value based on the first highlight value, the reflection value, the second highlight value, the third highlight value and the fourth highlight value comprises: Based on the first highlight value and the third highlight value, determining the illumination value of the position to be rendered on the varnish layer; Determine, based on the reflection value, the second highlight value, and the fourth highlight value, a lighting value on the outer surface layer and at the position to be rendered; and Based on the illumination value of the position to be rendered on the clear coat layer and the illumination value of the position to be rendered on the exterior surface layer, a target illumination value of the position to be rendered is determined.

17. A device for rendering an exterior of a virtual object, wherein: The device comprises: A varnish layer processing module, used to determine a first highlight value of a varnish layer of a virtual object under a light source, wherein the varnish layer is a varnish material covering an outer surface layer of the virtual object; An acquisition module, used to acquire the original reflection value of the outer surface layer and the transmittance of the varnish layer; An exterior surface processing module, used for determining a reflection value and a second highlight value of the exterior surface under the light source according to the original reflection value and the transmittance; a target illumination value determination module, configured to determine a target illumination value based on the first highlight value, the reflection value, and the second highlight value; and A rendering module is used to perform lighting rendering on the exterior of the virtual object according to the target lighting value.

18. A computer device comprising a memory and one or more processors, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processors, the one or more processors execute the steps of the method according to any one of claims 1 to 16.

19. One or more non-volatile readable storage media having computer readable instructions stored thereon, wherein when the computer readable instructions are executed by the processor, the one or more processors implement the steps of any one of the methods of claims 1 to 16.

20. A computer program product comprising computer readable instructions, which when executed by a processor implement the steps of the method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Indirect illumination multiplexing method based on object discrimination in three-dimensional scene rendering

    CN110751714A

  • Crystal stone model rendering method and device, electronic equipment and storage medium

    CN111899325A

  • Illumination rendering method and device, computer equipment and storage medium

    CN112927341A

  • Object rendering method and device thereof, storage medium and electronic equipment

    CN113648652A

  • Image rendering method and device and electronic equipment

    CN114155338A

Cited By

  • High-quality semitransparent object reconstruction method based on implicit micro rendering

    CN119963711A