Method for rendering a three-dimensional model, rendering device, equipment and medium

By assigning physically based rendering (PBR) materials to the 3D model and combining subsurface scattering and reflection algorithms, and processing rendering parameters in different regions, the problem of unstable display effect of 3D model when switching viewpoints is solved, and a realistic light transmission effect is achieved under different viewpoints.

CN116310056BActive Publication Date: 2026-06-30NETEASE (HANGZHOU) NETWORK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2023-03-02
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, the jelly-like texture of 3D models does not display well when the viewpoint changes, and the reliance on color maps with a fixed viewpoint leads to unstable effects.

Method used

Using physically based rendering (PBR) materials, combined with subsurface scattering and preset reflection algorithms, the rendering parameters of the 3D model are processed in different regions to ensure the realism of the gel-like texture from different perspectives.

Benefits of technology

It achieves the preservation of the translucency of the 3D model from different perspectives, with better translucency in thinner areas and weaker translucency in thicker areas, and the rendering effect is not affected by the change of perspective, thus improving the applicability and realism of the rendering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116310056B_ABST
    Figure CN116310056B_ABST
Patent Text Reader

Abstract

The application provides a rendering method and device of a three-dimensional model, equipment and a medium, and relates to the technical field of computers. The method comprises the following steps: assigning a physical-based rendering (PBR) material with a gelatinous texture to an initial three-dimensional model, adding a preset surface color map to the initial three-dimensional model, and obtaining a three-dimensional model to be rendered; obtaining a first rendering parameter based on a subsurface scattering algorithm; determining a first rendering area and a second rendering area of the three-dimensional model to be rendered based on a preset reflection algorithm, and determining a second rendering parameter corresponding to each pixel point; and rendering according to the first rendering parameter and the second rendering parameter to obtain a target three-dimensional model, so that the target three-dimensional model can present a subsurface scattering effect under different viewing angles through a regional rendering operation, and can also present a rendering effect of weak light transmission in thick places and good light transmission in thin places, so that the gelatinous texture is more realistic, and the rendering effect is not affected by viewing angle switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a rendering method, rendering device, equipment and medium for a three-dimensional model. Background Technology

[0002] 3D games are games that use spatial stereoscopic computing technology to achieve operation. From a programming perspective, the basic game model (game characters, scenes, basic terrain) is implemented using three-dimensional stereoscopic models, and the control of game characters is implemented using spatial stereoscopic programming algorithms.

[0003] In existing technologies, color mapping is mainly used to simulate the effect of jelly material in a single direction, thereby displaying the transparency of jelly material from a fixed viewpoint.

[0004] It can be seen that the display effect of the existing jelly material mainly relies on the color texture under a pre-set fixed viewpoint. Therefore, when applied to 3D games, the display effect will be poor due to the change of viewpoint. Summary of the Invention

[0005] The purpose of this application is to address the shortcomings of the prior art by providing a rendering method, rendering device, equipment, and medium for three-dimensional models that can maintain a good display effect even when the viewpoint is switched.

[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:

[0007] In a first aspect, the present invention provides a method for rendering a three-dimensional model, comprising:

[0008] Based on the initial 3D model, a physically based rendering PBR material is applied to the initial 3D model to give it a gel-like texture, and a preset surface color map is added to the initial 3D model to obtain the 3D model to be rendered.

[0009] The three-dimensional model to be rendered is processed based on the subsurface scattering algorithm to obtain the first rendering parameters corresponding to the three-dimensional model to be rendered.

[0010] The three-dimensional model to be rendered is processed based on a preset reflection algorithm to determine the first and second rendering regions of the three-dimensional model to be rendered. Based on the first and second rendering regions, the second rendering parameters corresponding to each pixel in the three-dimensional model to be rendered are determined. The dot product result corresponding to each first pixel in the first rendering region gradually decreases towards the direction of the observer's camera, and the dot product result corresponding to each second pixel in the second rendering region gradually increases towards the direction of the observer's camera.

[0011] The three-dimensional model to be rendered is rendered according to the first rendering parameters and the second rendering parameters to obtain the target three-dimensional model.

[0012] Secondly, the present invention provides a rendering apparatus for a three-dimensional model, comprising:

[0013] The setting module is used to assign a physically based rendering (PBR) material with a gelatinous texture to the initial 3D model, and add a preset surface color map to the initial 3D model to obtain the 3D model to be rendered.

[0014] The first processing module is used to process the three-dimensional model to be rendered based on the subsurface scattering algorithm to obtain the first rendering parameters corresponding to the three-dimensional model to be rendered.

[0015] The second processing module is used to process the three-dimensional model to be rendered based on a preset reflection algorithm, determine the first region to be rendered and the second region to be rendered of the three-dimensional model to be rendered, and determine the second rendering parameters corresponding to each pixel in the three-dimensional model to be rendered based on the first region to be rendered and the second region to be rendered. The dot product result corresponding to each first pixel in the first region to be rendered gradually decreases towards the direction of the observer's camera, and the dot product result corresponding to each second pixel in the second region to be rendered gradually increases towards the direction of the observer's camera.

[0016] The rendering module is used to render the three-dimensional model to be rendered according to the first rendering parameters and the second rendering parameters to obtain the target three-dimensional model.

[0017] Thirdly, the present invention provides an electronic device, comprising: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the rendering method for a three-dimensional model as described in any of the foregoing embodiments.

[0018] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the rendering method for a three-dimensional model as described in any of the foregoing embodiments.

[0019] The beneficial effects of this application are:

[0020] This application provides a rendering method, rendering apparatus, device, and medium for a three-dimensional model, comprising: applying a physically based rendering (PBR) material to an initial three-dimensional model, giving the initial three-dimensional model a gelatinous texture, and adding a preset surface color texture to the initial three-dimensional model to obtain a three-dimensional model to be rendered; processing the three-dimensional model to be rendered based on a subsurface scattering algorithm to obtain first rendering parameters corresponding to the three-dimensional model to be rendered; processing the three-dimensional model to be rendered based on a preset reflection algorithm to determine a first rendering region and a second rendering region of the three-dimensional model to be rendered, and determining second rendering parameters corresponding to each pixel in the three-dimensional model to be rendered based on the first rendering region and the second rendering region, wherein... In the first region to be rendered, the dot product of each first pixel gradually decreases towards the observer's camera, while in the second region to be rendered, the dot product of each second pixel gradually increases towards the observer's camera. Based on the first and second rendering parameters, the three-dimensional model to be rendered is rendered to obtain the target three-dimensional model. By applying the embodiments of this application, through the regional rendering operation, the obtained target three-dimensional model can exhibit a subsurface scattering effect from different perspectives. It can also exhibit a rendering effect where the light transmittance is weaker in thicker areas and better in thinner areas, making the gel-like texture more realistic. Moreover, the rendering effect is not affected by the change of perspective and has strong applicability. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A flowchart illustrating a rendering method for a three-dimensional model provided in an embodiment of this application;

[0023] Figure 2 A flowchart illustrating another method for rendering a three-dimensional model provided in an embodiment of this application;

[0024] Figure 3 A flowchart illustrating another method for rendering a three-dimensional model provided in an embodiment of this application;

[0025] Figure 4 A flowchart illustrating another method for rendering a three-dimensional model provided in an embodiment of this application;

[0026] Figure 5 A rendering effect of an initial three-dimensional model provided in an embodiment of this application;

[0027] Figure 6 A flowchart illustrating another method for rendering a three-dimensional model provided in an embodiment of this application;

[0028] Figure 7 A flowchart illustrating another method for rendering a three-dimensional model provided in an embodiment of this application;

[0029] Figure 8 A flowchart illustrating another method for rendering a three-dimensional model provided in an embodiment of this application;

[0030] Figure 9 A schematic diagram of the functional modules of a rendering device for a three-dimensional model provided in an embodiment of this application;

[0031] Figure 10 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0033] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0034] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0035] Before introducing this application, in order to better understand it, the relevant terms used in this application will first be explained:

[0036] Subsurface-Scattering (SSS) algorithm: a light transmission mechanism in which light penetrates the surface of an object and is reflected multiple times at irregular angles inside the material. The optical fiber that penetrates the object returns at an angle different from that when it is reflected directly from the surface of the object. The SSS algorithm is a graphics algorithm designed to simulate this effect.

[0037] Physically Based Rendering (PBR) mode: a material rendering mode that uses numerical values ​​to control material performance. Controllable performance attributes include base color, normals, specular highlights, roughness, metallicity, and transparency.

[0038] Normal mapping: Normal mapping is a special texture that can be applied to 3D surfaces, unlike traditional textures which can only be used on 2D surfaces. As an extension of bump mapping, normal mapping includes the height value of each pixel. You can think of a normal map as points perpendicular to the original surface, with all points forming another different surface. When a light source is applied at a specific location, precise lighting direction and reflection can be generated. Normal mapping is a material that alters the normal information of an object's material. In 3D modeling, normal mapping is often used to achieve a visual sense of bumpiness on 2D models to save computing power.

[0039] Fresnel algorithm: An algorithm used to simulate the Fresnel effect, where the Fresnel effect refers to the weak reflection when the line of sight is perpendicular to the surface of an object, and the more obvious the reflection when the line of sight is not perpendicular to the surface of an object, the smaller the angle.

[0040] Figure 1 This is a flowchart illustrating a rendering method for a 3D model provided in an embodiment of this application. The execution entity of this method can be an electronic device capable of performing 3D model rendering operations, such as a computer, server, or processor. Optionally, the rendering method provided in this embodiment can be adapted to any scene requiring the presentation of a gelatinous texture, such as game scenes, media and advertising, or 3D animation, and is not limited thereto. Figure 1 As shown, the method may include:

[0041] S101. Based on the initial 3D model, apply a physically based rendering PBR material to the initial 3D model to give it a gel-like texture, and add a preset surface color map to the initial 3D model to obtain the 3D model to be rendered.

[0042] Optionally, the initial 3D model can be a 3D model simulating any object, without limitation. Based on the initial 3D model, a PBR material with a gel-like texture can be applied to the initial 3D model. The gel-like texture can be understood as a jelly-like texture, and the gel-like texture can be transparent or semi-transparent, without limitation.

[0043] In some embodiments, the process of assigning a gelatinous textured PBR material to the initial 3D model can be completed in the PBR mode of a preset rendering engine. Optionally, the preset rendering engine can be Unreal Engine 4 (UE4), Unreal Engine 5 (UE5), etc., and is not limited here. Of course, it should be noted that in PBR mode, the properties of the PBR material can also be set, such as the parameters of the normal map and the self-illumination channel, etc., which are not limited here.

[0044] The preset surface color map can be pre-defined, and different preset surface color maps can be customized according to different application scenarios. Based on the above description, after applying a gel-like PBR material to the initial 3D model, a preset surface color map can be added to the initial 3D model, and the initial 3D model with the added map can be used as the 3D model to be rendered.

[0045] S102. The subsurface scattering algorithm is used to process the 3D model to be rendered to obtain the first rendering parameters corresponding to the 3D model to be rendered.

[0046] Optionally, the subsurface scattering process of the 3D model to be rendered can be performed in the subsurface scattering mode of the preset rendering engine. It can be understood that the first rendering parameters obtained at this time can simulate the effect of light being refracted and scattered multiple times within the 3D model after illumination.

[0047] S103. Based on the preset reflection algorithm, process the 3D model to be rendered, determine the first and second rendering regions of the 3D model to be rendered, and based on the first and second rendering regions, determine the second rendering parameters corresponding to each pixel in the 3D model to be rendered.

[0048] In the first region to be rendered, the dot product result of each first pixel gradually decreases towards the observer's camera, while in the second region to be rendered, the dot product result of each second pixel gradually increases towards the observer's camera.

[0049] Optionally, the preset reflection algorithm can be the Fresnel algorithm, which is not limited here. In some embodiments, when processing the reflection effect of the 3D model to be rendered, it can be done through the reflection mode in the preset rendering engine. It is understood that the second rendering parameters obtained at this time can be used to simulate the effect of weak reflection and good light transmission when the line of sight is perpendicular to the surface of the 3D model to be rendered, and strong reflection and poor light transmission when the line of sight is not perpendicular to the surface of the 3D model to be rendered.

[0050] Optionally, if the 3D model to be rendered is a spherical model, then the spherical model can be divided into a first rendering region and a second rendering region from the center to the edge. It should be noted that the specific distribution of the first and second rendering regions is not limited to this. Through the above division, the second rendering parameters corresponding to each pixel in the first and second rendering regions can be calculated separately.

[0051] It should be noted that this application does not limit the execution order of S102 and S103. Depending on the actual application scenario, S102 can be executed first and then S103, or S103 can be executed first and then S102.

[0052] S104. Render the 3D model to be rendered according to the first rendering parameters and the second rendering parameters to obtain the target 3D model.

[0053] Based on the processing steps S102 and S103 above, after obtaining the first rendering parameters and the second rendering parameters, the three-dimensional model to be rendered can be rendered accordingly to obtain the target three-dimensional model. The target three-dimensional model obtained at this time not only has weak light transmission in thick areas and good light transmission in thin areas, but also exhibits a subsurface scattering effect when illuminated, making the gel-like texture more realistic. Moreover, the presentation of this rendering effect is not affected by the switching of the viewpoint.

[0054] In summary, this application provides a rendering method for a three-dimensional model. The method includes: assigning a physically based rendering (PBR) material with a gelatinous texture to an initial three-dimensional model, and adding a preset surface color texture to the initial three-dimensional model to obtain a three-dimensional model to be rendered; processing the three-dimensional model to be rendered based on a subsurface scattering algorithm to obtain first rendering parameters corresponding to the three-dimensional model to be rendered; processing the three-dimensional model to be rendered based on a preset reflection algorithm to determine a first rendering region and a second rendering region of the three-dimensional model to be rendered, and determining second rendering parameters corresponding to each pixel in the three-dimensional model to be rendered based on the first rendering region and the second rendering region, wherein the first rendering region... The dot product of each first pixel in the rendering area gradually decreases towards the observer's camera, while the dot product of each second pixel in the second rendering area gradually increases towards the observer's camera. Based on the first and second rendering parameters, the 3D model to be rendered is rendered to obtain the target 3D model. By applying the embodiments of this application, through the regional rendering operation, the obtained target 3D model can present a subsurface scattering effect from different perspectives. It can also exhibit a rendering effect where the light transmittance is weak in thick areas and good in thin areas, making the gel-like texture more realistic. Moreover, the rendering effect is not affected by the change of perspective and has strong applicability.

[0055] Figure 2 This is a flowchart illustrating another method for rendering a 3D model provided in an embodiment of this application. Optionally, as... Figure 2 As shown, the above-mentioned processing of the 3D model to be rendered based on a preset reflection algorithm determines the first and second rendering regions of the 3D model to be rendered, and based on the first and second rendering regions, determines the second rendering parameters corresponding to each pixel in the 3D model to be rendered, including:

[0056] S201. Based on the orientation of the observer camera in the 3D model to be rendered, perform a dot product operation on the orientation vector of the observer camera and the normal vector of each pixel in the 3D model to be rendered to obtain the dot product result corresponding to each pixel.

[0057] If the preset reflection algorithm is the Fresnel algorithm, it can be understood that the orientation of the observer's camera will be different under different viewing angles of the 3D model to be rendered. Based on the orientation of the observer's camera in the 3D model to be rendered, the dot product of the observer's camera orientation vector and the normal vector of each pixel in the 3D model to be rendered can be calculated to obtain the dot product result for each pixel. The dot product result for each pixel can be any value from 0 to 1.

[0058] Optionally, the normal vectors of each pixel in the 3D model to be rendered can be obtained from the normal map corresponding to the 3D model to be rendered. Of course, the specific method of obtaining them is not limited to this.

[0059] S202. Based on the dot product results corresponding to each pixel, determine the first and second rendering regions of the 3D model to be rendered, and based on the first and second rendering regions, determine the second rendering parameters corresponding to each pixel in the 3D model to be rendered.

[0060] Based on the dot product values ​​of each pixel, the 3D model to be rendered can be divided into a first rendering region and a second rendering region. In the first rendering region, the dot product value of each first pixel gradually decreases from 1 to 0 towards the observer's camera, while in the second rendering region, the dot product value of each second pixel gradually increases from 0 to 1 towards the observer's camera. Based on these first and second rendering regions, different second rendering parameters can be set for each pixel.

[0061] Optionally, the first rendering region includes the central rendering region of the initial 3D model, and the second rendering region includes the edge rendering regions of the initial 3D model. The determination of the second rendering parameters corresponding to each pixel in the 3D model to be rendered, based on the first and second rendering regions, includes:

[0062] Based on the preset specular parameters, the second rendering parameters corresponding to each pixel in the first and second rendering areas are calculated. The preset specular parameters include: preset specular intensity parameters, preset specular range parameters, and preset specular color parameters.

[0063] The preset specular intensity parameter controls the brightness of the specular highlights of each pixel in the area to be rendered; the preset specular range parameter controls the range of the specular highlights of each pixel in the area to be rendered; and the preset specular color parameter controls the lighting color of the light transmission effect of each pixel in the area to be rendered. Optionally, during calculation, based on the preset specular intensity parameter, preset specular range parameter, and preset specular color parameter, the second rendering parameters corresponding to each pixel in the first and second areas to be rendered can be calculated separately for each area. Optionally, the second rendering parameters corresponding to each pixel may include specular intensity rendering parameters, specular range rendering parameters, and specular color parameters, etc., which are not limited here.

[0064] By applying the embodiments of this application, during the rendering process, the second rendering parameters corresponding to each pixel can be quickly determined based on the preset specular parameters, which simplifies the calculation and ensures that the method provided by the embodiments of this application can run with extremely low operating costs, making it more applicable.

[0065] Figure 3 This is a flowchart illustrating another method for rendering a 3D model provided in an embodiment of this application. Optionally, as... Figure 3 As shown, based on the preset specular parameters, the above-mentioned calculation of the second rendering parameters corresponding to each pixel in the first and second regions to be rendered includes:

[0066] S401. Calculate the first specular rendering parameters corresponding to each first pixel in the first region to be rendered, based on the preset first specular parameters.

[0067] The preset first specular parameters include: a first specular intensity parameter, a first specular range parameter, and a first specular color parameter. The preset first specular parameters can also be understood as center specular parameters. The values ​​of the first specular intensity parameter and the first specular range parameter can be arbitrary. The first specular intensity parameter controls the brightness of the specular highlight of each first pixel in the first area to be rendered, and the first specular range parameter controls the range of the specular highlight of each first pixel in the first area to be rendered. The first specular color parameter can be any color value and can be used to control the lighting color of the light transmission effect of each first pixel in the first area to be rendered.

[0068] In some embodiments, the value of the first highlight intensity parameter can be 1, the value of the first highlight range parameter can be 19.8, and the value of the first highlight color parameter can be FF0000FF, which is red. Of course, the specific values ​​of each parameter are not limited to these.

[0069] S402. Calculate the second specular rendering parameters corresponding to each second pixel in the second region to be rendered, based on the preset second specular parameters.

[0070] Among them, the preset second highlight parameter can be understood as the edge highlight parameter. The values ​​of the second highlight intensity parameter and the second highlight range parameter can be arbitrary, and the second highlight color parameter can be any color value. It can be used to control the lighting color of the light transmission effect in the second area to be rendered.

[0071] The preset second highlight parameters include: second highlight intensity parameter, second highlight range parameter, and second highlight color parameter.

[0072] In some embodiments, the value of the second highlight intensity parameter can be 2, the value of the second highlight range parameter can be 12.8, and the value of the second highlight color parameter can be FF2A00FF, which is deep red (ochre red). Of course, the specific values ​​of each parameter are not limited to these.

[0073] S403. By superimposing the first and second specular rendering parameters, the second rendering parameters corresponding to each pixel are obtained.

[0074] Based on the above explanation, after obtaining the first and second specular rendering parameters, these two parameters can be superimposed to obtain the second rendering parameters corresponding to each pixel. When rendering each pixel based on the second rendering parameters corresponding to each pixel, the rendering effect can be achieved when the line of sight is perpendicular to the surface of the 3D model to be rendered, the reflection is weak and the light transmission is good, while when the line of sight is not perpendicular to the surface of the 3D model to be rendered, the reflection is strong and the light transmission is poor.

[0075] Figure 4 This is a flowchart illustrating another rendering method for a 3D model provided in an embodiment of this application. The aforementioned first specular highlight rendering parameters include: a first specular highlight intensity rendering parameter, a first specular highlight range rendering parameter, and a first specular highlight color rendering parameter. Taking a first region to be rendered as an example, optionally, as... Figure 4 As shown, the above calculation of the first specular rendering parameters corresponding to each first pixel in the first region to be rendered, based on preset first specular parameters, includes:

[0076] S501. The product of the first highlight intensity parameter and the dot product of each first pixel in the first area to be rendered is used as the first highlight intensity rendering parameter for each first pixel.

[0077] S502. Using the dot product result of each first pixel in the first area to be rendered as the base and the first specular range parameter as the exponent, calculate the first specular range rendering parameter corresponding to each first pixel.

[0078] Based on the calculation principle of the first highlight intensity rendering parameter and the first highlight range rendering parameter corresponding to each first pixel in the first region to be rendered, it can be known that the larger the dot product result of each first pixel in the first region to be rendered, the larger the first highlight intensity rendering parameter and the larger the first highlight range rendering parameter corresponding to that pixel.

[0079] S503. The product of the first specular color parameter and the dot product of the first pixel point in the first area to be rendered is used as the first specular color rendering parameter for each first pixel point.

[0080] Based on the calculation principle of the first specular color rendering parameters corresponding to each first pixel, when the dot product results of each first pixel in the first area to be rendered are different, the first specular color rendering parameters corresponding to each first pixel will be different.

[0081] In some embodiments, the second specular rendering parameters include: a second specular intensity rendering parameter, a second specular range rendering parameter, and a second specular color rendering parameter. Optionally, the calculation process of the first specular rendering parameters corresponding to each first pixel can be referred to to calculate the second specular rendering parameters corresponding to each second pixel, which will not be repeated here.

[0082] It's worth noting that the larger the second specular intensity parameter, the larger the second specular intensity rendering parameter obtained based on it will be. Therefore, when rendering each pixel in the second region to be rendered according to the second specular intensity rendering parameter, the brightness of each pixel will be greater. Furthermore, for the second specular range parameter, since the dot product of each pixel in the second region to be rendered needs to be used as the base and the second specular range parameter as the exponent to calculate the second specular range rendering parameter for each pixel, when rendering each pixel in the second region to be rendered according to the second specular range rendering parameter, the closer the dot product of each pixel is to 0, the weaker the self-emission brightness of that pixel.

[0083] Figure 5 The rendering effect of an initial three-dimensional model provided in the embodiments of this application, from which... Figure 5 As can be seen from the embodiments of this application, a more realistic and natural gel-like texture can be presented, and the rendering effect is not affected by the switching of the viewpoint. That is, the gel-like texture can be guaranteed under various viewpoints, which has the characteristics of greater applicability.

[0084] Figure 6 This is a flowchart illustrating another method for rendering a 3D model provided in an embodiment of this application. Optionally, as... Figure 6 As shown, the above method also includes:

[0085] S601. In response to a rotation operation on the target 3D model, obtain the current orientation of the observer camera corresponding to the rotation operation.

[0086] In some embodiments, the method provided in this application is applied to a game scene. Considering that the actual game scene needs to switch the viewpoint of the target 3D model through rotation operation, the current orientation of the observer camera corresponding to the rotation operation can be obtained in real time in the game scene in response to the rotation operation.

[0087] S602. Based on the current orientation of the observer's camera, update the second rendering parameters corresponding to the target 3D model.

[0088] Based on the current orientation of the observer camera, the dot product of the current orientation of the observer camera and the normal vector of each pixel in the 3D model to be rendered can be calculated, and the second rendering parameters corresponding to each pixel can be updated accordingly. The specific update process can be found in the above S301 and S302, and will not be repeated here.

[0089] S603. Re-render the target 3D model based on the updated second rendering parameters.

[0090] Based on the foregoing explanation, it can be seen that if the orientation of the observer camera is adjusted, only the current orientation of the observer camera needs to be passed into the rendering logic above, without adjusting other parameters. Therefore, it is possible to simulate the material's appearance in the real world with low runtime consumption, that is, while optimizing rendering efficiency, it can also ensure realistic rendering effects. In particular, applying the embodiments of this application to game scenes can be used to render virtual objects with jelly-like materials in game scenes, displaying realistic material effects, and the low runtime consumption during the rendering process can improve the smoothness of game operation and avoid game lag.

[0091] Figure 7 This is a flowchart illustrating another method for rendering a 3D model provided in an embodiment of this application. Optionally, as... Figure 7 As shown, the above method also includes:

[0092] S701, In response to the adjustment operation of the preset rendering parameters in the target 3D model, the rendering effect of the target 3D model is adjusted by using the target rendering parameters corresponding to the adjustment operation.

[0093] The preset rendering parameters include at least one of the following: metallicity, roughness, specularity, and transparency.

[0094] In some embodiments, the rendering parameters of the target 3D model obtained above can be further adjusted. For example, the metallicity, roughness, specularity, and transparency of the target 3D model can be adjusted. This is not limited here, and can be flexibly selected according to the actual application scenario.

[0095] For example, in some embodiments, the metallicity of the target 3D model can be further adjusted to 0.2, the roughness to 0.24, and the specularity to 1 using a preset rendering engine. Of course, the specific adjustment values ​​are not limited to these. Optionally, when adjusting the preset rendering parameters in the target 3D model, it can be done in the PBR mode of the preset rendering engine. Of course, the specific adjustment method is not limited to this.

[0096] Figure 8 This is a flowchart illustrating another method for rendering a 3D model provided in an embodiment of this application. Optionally, as... Figure 8 As shown, the above process of rendering the 3D model to be rendered based on the first and second rendering parameters to obtain the target 3D model includes:

[0097] S801. Based on the first rendering parameters, perform the first rendering operation on the 3D model to be rendered to obtain the first 3D model to be rendered.

[0098] S802. Based on the second rendering parameters, adjust the rendering parameters in the self-illuminating channel corresponding to the first 3D model to be rendered to obtain the target 3D model.

[0099] Optionally, when rendering the 3D model to be rendered, the first rendering parameters described above can be used to perform a first rendering operation on the 3D model to be rendered to obtain a first 3D model to be rendered; then, based on the second rendering parameters described above, the rendering parameters corresponding to each pixel in the self-illuminating channel of the first 3D model to be rendered can be adjusted to obtain the target 3D model.

[0100] It should be noted that this application does not limit the specific rendering steps. Of course, it is also possible to first adjust the rendering parameters in the self-illumination channel of the 3D model to be rendered according to the second rendering parameters mentioned above, and then use the first rendering parameters mentioned above to further render based on the rendering result to obtain the target 3D model. The rendering order can be flexibly adjusted according to the actual application scenario.

[0101] Figure 9This is a functional module diagram of a rendering device for a three-dimensional model provided in this application embodiment. The basic principle and technical effects of this device are the same as those of the corresponding method embodiment described above. For the sake of brevity, parts not mentioned in this embodiment can be referred to the corresponding content in the method embodiment. Figure 9 As shown, the rendering apparatus may include:

[0102] The setting module 110 is used to assign a physically based rendering PBR material with a gel-like texture to the initial three-dimensional model, and add a preset surface color map to the initial three-dimensional model to obtain the three-dimensional model to be rendered.

[0103] The first processing module 120 is used to process the three-dimensional model to be rendered based on the subsurface scattering algorithm to obtain the first rendering parameters corresponding to the three-dimensional model to be rendered.

[0104] The second processing module 130 is used to process the three-dimensional model to be rendered based on a preset reflection algorithm, determine the first region to be rendered and the second region to be rendered of the three-dimensional model to be rendered, and determine the second rendering parameters corresponding to each pixel in the three-dimensional model to be rendered based on the first region to be rendered and the second region to be rendered, wherein the dot product result corresponding to each first pixel in the first region to be rendered gradually decreases towards the direction of the observer's camera, and the dot product result corresponding to each second pixel in the second region to be rendered gradually increases towards the direction of the observer's camera.

[0105] The rendering module 140 is used to render the three-dimensional model to be rendered according to the first rendering parameters and the second rendering parameters to obtain the target three-dimensional model.

[0106] Optionally, the second processing module 130 described above can be specifically used to perform a dot product operation on the orientation vector of the observer camera and the normal vector of each pixel in the three-dimensional model to be rendered based on the orientation of the observer camera in the three-dimensional model to be rendered, so as to obtain the dot product result corresponding to each pixel.

[0107] Based on the dot product results corresponding to each pixel, the first and second rendering regions of the 3D model to be rendered are determined, and based on the first and second rendering regions, the second rendering parameters corresponding to each pixel in the 3D model to be rendered are determined.

[0108] Optionally, the first region to be rendered includes the center region to be rendered of the initial 3D model, and the second region to be rendered includes the edge region to be rendered of the initial 3D model; the second processing module 130 can be specifically used to calculate the second rendering parameters corresponding to each pixel point for the first region to be rendered and the second region to be rendered based on preset specular parameters, wherein the preset specular parameters include: preset specular intensity parameters, preset specular range parameters, and preset specular color parameters.

[0109] Optionally, the second processing module 130 described above can be specifically used to calculate the first specular rendering parameters corresponding to each first pixel in the first region to be rendered based on the preset first specular parameters. The preset first specular parameters include: first specular intensity parameters, first specular range parameters, and first specular color parameters.

[0110] Based on the preset second highlight parameters, the second highlight rendering parameters corresponding to each second pixel in the second region to be rendered are calculated. The preset second highlight parameters include: second highlight intensity parameters, second highlight range parameters, and second highlight color parameters.

[0111] By superimposing the first specular rendering parameters and the second specular rendering parameters, the second rendering parameters corresponding to each pixel are obtained.

[0112] Optionally, the first specular rendering parameters include: a first specular intensity rendering parameter, a first specular range rendering parameter, and a first specular color rendering parameter.

[0113] The second processing module 130 described above can be specifically used to take the product of the first highlight intensity parameter and the dot product result of each first pixel in the first area to be rendered as the first highlight intensity rendering parameter corresponding to each first pixel.

[0114] Using the dot product result of each first pixel in the first region to be rendered as the base and the first specular range parameter as the exponent, calculate the first specular range rendering parameter corresponding to each first pixel.

[0115] The product of the first specular color parameter and the dot product of the first pixel points in the first region to be rendered is used as the first specular color rendering parameter for each first pixel point.

[0116] Optionally, the rendering module 140 described above can also be used to obtain the current orientation of the observer camera corresponding to the rotation operation in response to the rotation operation of the target 3D model;

[0117] Based on the current orientation of the observer camera, update the second rendering parameters corresponding to the target 3D model;

[0118] The target 3D model is re-rendered based on the updated second rendering parameters.

[0119] Optionally, the rendering module 140 can also be used to adjust the rendering effect of the target three-dimensional model in response to the adjustment operation of the preset rendering parameters in the target three-dimensional model, and the preset rendering parameters include at least one of the following: metallicity, roughness, specularity, and transparency.

[0120] Optionally, the rendering module 140 is specifically used to perform a first rendering operation on the three-dimensional model to be rendered according to the first rendering parameters to obtain a first three-dimensional model to be rendered.

[0121] Based on the second rendering parameters, the rendering parameters in the self-illuminating channel corresponding to the first 3D model to be rendered are adjusted to obtain the target 3D model.

[0122] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.

[0123] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0124] Figure 10 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. This electronic device can be integrated into the aforementioned rendering device. Figure 10 As shown, the electronic device may include a processor 210, a storage medium 220, and a bus 230. The storage medium 220 stores machine-readable instructions executable by the processor 210. When the electronic device is running, the processor 210 communicates with the storage medium 220 via the bus 230, and the processor 210 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation and technical effects are similar and will not be described in detail here.

[0125] Optionally, this application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the above-described method embodiments. The specific implementation and technical effects are similar and will not be repeated here.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0127] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0128] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.

[0129] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

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

[0131] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need further definition and explanation in subsequent figures. The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for rendering a three-dimensional model, characterized in that, include: Based on the initial 3D model, a physically based rendering PBR material is applied to the initial 3D model to give it a gel-like texture, and a preset surface color map is added to the initial 3D model to obtain the 3D model to be rendered. The subsurface scattering algorithm is used to process the three-dimensional model to be rendered to obtain the first rendering parameters corresponding to the three-dimensional model to be rendered. The first rendering parameters are used to simulate the effect of light being scattered in the three-dimensional model to be rendered after illumination. The three-dimensional model to be rendered is processed based on a preset reflection algorithm to determine a first rendering region and a second rendering region of the three-dimensional model to be rendered. Based on the first rendering region and the second rendering region, a second rendering parameter corresponding to each pixel in the three-dimensional model to be rendered is determined. In the first rendering region, the dot product result corresponding to each first pixel gradually decreases towards the direction of the observer's camera, and the dot product result corresponding to each second pixel in the second rendering region gradually increases towards the direction of the observer's camera. The second rendering parameter is used to simulate the light transmittance of the three-dimensional model to be rendered. The preset reflection algorithm includes Fresnel algorithm. The first rendering region includes the center rendering region of the initial three-dimensional model, and the second rendering region includes the edge rendering region of the initial three-dimensional model. The three-dimensional model to be rendered is rendered according to the first rendering parameters and the second rendering parameters to obtain the target three-dimensional model; The step of determining the second rendering parameters corresponding to each pixel in the 3D model to be rendered based on the first region to be rendered and the second region to be rendered includes: By superimposing the first specular rendering parameters corresponding to each first pixel in the first region to be rendered and the second specular rendering parameters corresponding to each second pixel in the second region to be rendered, the second rendering parameters corresponding to each pixel are obtained. The first specular rendering parameters corresponding to each first pixel in the first region to be rendered are calculated based on preset first specular parameters, which include: first specular intensity parameters, first specular range parameters, and first specular color parameters; the first specular rendering parameters include: first specular intensity rendering parameters, first specular range rendering parameters, and first specular color rendering parameters. The method further includes: The product of the first specular intensity parameter and the dot product of each first pixel in the first region to be rendered is used as the first specular intensity rendering parameter for each first pixel. Using the dot product result of each first pixel in the first region to be rendered as the base and the first specular range parameter as the exponent, calculate the first specular range rendering parameter corresponding to each first pixel. The product of the first specular color parameter and the dot product of the first pixel points in the first region to be rendered is used as the first specular color rendering parameter for each first pixel point.

2. The method according to claim 1, characterized in that, The process of processing the 3D model to be rendered based on a preset reflection algorithm determines a first rendering region and a second rendering region of the 3D model to be rendered, and, based on the first rendering region and the second rendering region, determines the second rendering parameters corresponding to each pixel in the 3D model to be rendered, including: Based on the orientation of the observer camera in the 3D model to be rendered, a dot product operation is performed on the orientation vector of the observer camera and the normal vector of each pixel in the 3D model to be rendered to obtain the dot product result corresponding to each pixel. Based on the dot product results corresponding to each pixel, the first rendering region and the second rendering region of the 3D model to be rendered are determined, and based on the first rendering region and the second rendering region, the second rendering parameters corresponding to each pixel in the 3D model to be rendered are determined.

3. The method according to claim 2, characterized in that, The step of determining the second rendering parameters corresponding to each pixel in the 3D model to be rendered based on the first region to be rendered and the second region to be rendered includes: Based on preset specular parameters, for the first region to be rendered and the second region to be rendered, the second rendering parameters corresponding to each pixel are calculated. The preset specular parameters include: preset specular intensity parameters, preset specular range parameters, and preset specular color parameters.

4. The method according to claim 3, characterized in that, The method further includes: Based on the preset first specular parameters, calculate the first specular rendering parameters corresponding to each first pixel in the first region to be rendered. Based on the preset second specular parameters, the second specular rendering parameters corresponding to each second pixel in the second region to be rendered are calculated. The preset second specular parameters include: second specular intensity parameters, second specular range parameters, and second specular color parameters.

5. The method according to claim 1, characterized in that, The method further includes: In response to a rotation operation on the target 3D model, the current orientation of the observer camera corresponding to the rotation operation is obtained; Based on the current orientation of the observer camera, update the second rendering parameters corresponding to the target 3D model; The target 3D model is re-rendered based on the updated second rendering parameters.

6. The method according to claim 1, characterized in that, The method further includes: In response to the adjustment operation of the preset rendering parameters in the target 3D model, the rendering effect of the target 3D model is adjusted using the target rendering parameters corresponding to the adjustment operation. The preset rendering parameters include at least one of the following: metallicity, roughness, specularity, and transparency.

7. The method according to any one of claims 1-6, characterized in that, The step of rendering the 3D model to be rendered according to the first rendering parameters and the second rendering parameters to obtain the target 3D model includes: Based on the first rendering parameters, a first rendering operation is performed on the three-dimensional model to be rendered to obtain a first three-dimensional model to be rendered. Based on the second rendering parameters, the rendering parameters in the self-illuminating channel corresponding to the first 3D model to be rendered are adjusted to obtain the target 3D model.

8. A rendering device for a three-dimensional model, characterized in that, include: The setting module is used to assign a physically based rendering (PBR) material with a gelatinous texture to the initial 3D model, and add a preset surface color map to the initial 3D model to obtain the 3D model to be rendered. The first processing module is used to process the three-dimensional model to be rendered based on the subsurface scattering algorithm to obtain the first rendering parameters corresponding to the three-dimensional model to be rendered. The first rendering parameters are used to simulate the effect of light being scattered in the three-dimensional model to be rendered after illumination. The second processing module is used to process the 3D model to be rendered based on a preset reflection algorithm, determine the first and second rendering regions of the 3D model to be rendered, and determine the second rendering parameters corresponding to each pixel in the 3D model to be rendered based on the first and second rendering regions. The dot product result corresponding to each first pixel in the first rendering region gradually decreases towards the direction of the observer's camera, and the dot product result corresponding to each second pixel in the second rendering region gradually increases towards the direction of the observer's camera. The second rendering parameters are used to simulate the light transmittance of the 3D model to be rendered. The preset reflection algorithm includes the Fresnel algorithm. The rendering module is used to render the three-dimensional model to be rendered according to the first rendering parameters and the second rendering parameters to obtain the target three-dimensional model; The second processing module is specifically used to superimpose the first specular rendering parameters corresponding to each first pixel in the first region to be rendered and the second specular rendering parameters corresponding to each second pixel in the second region to be rendered to obtain the second rendering parameters corresponding to each pixel. The first region to be rendered includes the center region to be rendered of the initial three-dimensional model, and the second region to be rendered includes the edge region to be rendered of the initial three-dimensional model. The first specular rendering parameters corresponding to each first pixel in the first region to be rendered are calculated based on preset first specular parameters, which include: first specular intensity parameters, first specular range parameters, and first specular color parameters; the first specular rendering parameters include: first specular intensity rendering parameters, first specular range rendering parameters, and first specular color rendering parameters. The second processing module is further configured to use the product of the first specular intensity parameter and the dot product result of each first pixel in the first rendering area as the first specular intensity rendering parameter corresponding to each first pixel. Using the dot product result of each first pixel in the first region to be rendered as the base and the first specular range parameter as the exponent, calculate the first specular range rendering parameter corresponding to each first pixel. The product of the first specular color parameter and the dot product of the first pixel points in the first region to be rendered is used as the first specular color rendering parameter for each first pixel point.

9. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the rendering method for the three-dimensional model as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the rendering method for the three-dimensional model as described in any one of claims 1-7.