Three-dimensional model rendering method and device, medium and equipment

By combining PBR rendering and custom fast subsurface scattering algorithm in the field of intelligent education, the problem of poor rendering of three-dimensional model is solved, the rendering effect and speed are improved, and it is suitable for applications in smart terminals.

CN119131225APending Publication Date: 2024-12-13BEIJING XUEDIRUANJIAN DEVELOPMENT CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411354160.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Existing physics-based rendering technology is limited in creating art works in stylized or dedicated fields. Especially in the field of intelligent education, the dark visual effect of 3D models is poor, affecting the efficiency of emotional transmission and information transmission.

Method used

The basic PBR rendering based on the initial three-dimensional model and map is adopted, and the fast subsurface scattering algorithm is customized in the surface shader. The approximate scattering parameters are calculated through the dot product of the normal and the light source direction, and the rendering effect of the three-dimensional model is optimized.

Benefits of technology

The rendering effect of the three-dimensional model, especially the dark visual effect, is suitable for application scenarios such as intelligent teaching of smart terminals, and achieves fast rendering speed and realistic light transmission effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131225A_ABST
    Figure CN119131225A_ABST
Patent Text Reader

Abstract

The invention provides a three-dimensional model rendering method and device, a medium and equipment, and the method comprises the steps: carrying out the basic PBR rendering based on an initial three-dimensional model and a chartlet, and obtaining a basic three-dimensional model; in a surface shader, creating a fast subsurface scattering algorithm with simple light transmission based on dot product custom of a normal and a light source direction, and calculating the basic three-dimensional model based on the fast subsurface scattering algorithm to obtain approximate scattering parameters; and performing rendering optimization on the basic three-dimensional model according to the approximate scattering parameters, and outputting the optimized three-dimensional model. The rendering effect can be optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer graphics, and in particular to a three-dimensional model rendering method, device, medium and equipment. Background Art

[0002] With the continuous advancement of 3D technology, more and more Internet applications will be presented to users in 3D in the future, including online video, e-reading, online games, virtual communities, e-commerce, smart education, etc.

[0003] At present, 3D models are usually rendered using standard physically based rendering (PBR) technology, which focuses on achieving physically correct visual effects. Therefore, its flexibility is limited when creating stylized or specialized artworks. For example, in the field of intelligent education, the emotional transmission function of 3D rendering and the information transmission efficiency of educational scenes take precedence over physically correct visual effects, and a comfortable visual experience is more easily accepted in educational scenes. In particular, in the process of cooperating with artists to complete the work, it was found that the output of the standard PBR technology had the problem of poor visual effects in the dark parts of the model. Summary of the invention

[0004] In view of this, the present application provides a three-dimensional model rendering method, device, medium and electronic device, the main purpose of which is to optimize the three-dimensional model rendering method and improve the rendering effect.

[0005] According to one aspect of the present application, a three-dimensional model rendering method is provided, comprising:

[0006] Perform basic physically based rendering (PBR) based on the initial 3D model and texture to obtain a basic 3D model;

[0007] In the surface shader, a fast subsurface scattering algorithm with simple light transmittance is created based on the dot product of the normal and the light source direction, and the basic three-dimensional model is calculated based on the fast subsurface scattering algorithm to obtain approximate scattering parameters;

[0008] The basic three-dimensional model is rendered and optimized according to the approximate scattering parameters, and the optimized three-dimensional model is output.

[0009] In one implementation, performing basic PBR rendering based on the initial three-dimensional model and the texture to obtain a basic three-dimensional model includes:

[0010] According to the initial three-dimensional model, assigning a PBR material to the initial three-dimensional model;

[0011] A preset map is added to the initial three-dimensional model to complete the PBR rendering of the initial three-dimensional model.

[0012] In one implementation,

[0013] Assigning a PBR material to the initial three-dimensional model according to the initial three-dimensional model includes: selecting a PBR material according to PBR material parameters, wherein the PBR material parameters include one or more of albedo, normal map, metalness, roughness, and ambient occlusion;

[0014] The adding of preset textures to the initial three-dimensional model to complete the PBR rendering of the initial three-dimensional model includes: adding different preset surface color textures preset based on different scenes to the initial three-dimensional model of the corresponding scene to obtain the basic three-dimensional model.

[0015] In one implementation, the fast subsurface scattering algorithm for creating simple light transmittance based on the dot product of the normal and the light source direction in the surface shader includes:

[0016] In the surface shader, specific compilation instructions and structures are used to define a lighting model and a surface processing function;

[0017] Based on the surface processing function, the fast subsurface scattering algorithm based on the dot product of the normal and the light source direction is customized.

[0018] In one implementation,

[0019] The shader type is Surface Shader, and a surf function is defined in Surface Shader as the surface processing function. The surface processing function accepts an Input structure and an inoutSurfaceOutput structure as parameters, wherein the Input structure includes texture coordinates and variables, and the SurfaceOutput structure is used to output surface properties.

[0020] In one implementation, calculating the basic three-dimensional model based on the fast subsurface scattering algorithm to obtain approximate scattering parameters includes:

[0021] Based on the fast subsurface scattering algorithm, the dot product between the normal vector of each pixel of the basic three-dimensional model and the light source direction vector is calculated as the approximate scattering parameter.

[0022] In one implementation, performing rendering optimization on the basic three-dimensional model according to the approximate scattering parameters includes:

[0023] Based on the dot product between the normal vector of each pixel and the light source direction vector, and the light source orientation determined according to the dot product, the pixel color of the basic three-dimensional model is adjusted.

[0024] In one implementation, adjusting the pixel color of the basic three-dimensional model based on the dot product between the normal vector of each pixel and the light source direction vector and the light source orientation determined according to the dot product includes:

[0025] Calculate the dot product between the normal vector at each pixel and the light source direction vector;

[0026] Determine the orientation of the light source relative to the surface based on the dot product value;

[0027] Use dot product values ​​to adjust the color and / or intensity of the lighting to simulate light transmittance;

[0028] The adjusted lighting color is combined with the diffuse reflection lighting model to obtain the final pixel color. When the light source is on the opposite side of the normal, the adjusted lighting color is output as the final color; when the light source is on the front side of the normal, the diffuse reflection lighting model is used to calculate the diffuse reflection lighting.

[0029] According to one aspect of the present application, a three-dimensional model rendering device is provided, comprising:

[0030] A basic rendering unit, used for performing basic physically based rendering (PBR) based on the initial three-dimensional model and the texture to obtain a basic three-dimensional model;

[0031] A fast subsurface scattering unit is used to customize a fast subsurface scattering algorithm for creating simple light transmittance based on the dot product of the normal and the light source direction in the surface shader, and to calculate the basic three-dimensional model based on the fast subsurface scattering algorithm to obtain approximate scattering parameters;

[0032] A rendering optimization unit is used to perform rendering optimization on the basic three-dimensional model according to the approximate scattering parameters and output the optimized three-dimensional model.

[0033] According to one aspect of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above-mentioned three-dimensional model rendering method.

[0034] Through the above technical solution, the present application provides a three-dimensional model rendering method, device, medium and equipment, which optimizes the rendering effect of the three-dimensional model through a customized fast subsurface scattering algorithm based on basic PBR rendering.

[0035] The solution proposed in this application can avoid the time-consuming problem of complex calculations of traditional subsurface scattering. Through fast subsurface scattering, that is, instead of directly simulating the scattering process of light inside the object, a fast subsurface scattering algorithm is used to approximate the scattering effect. The calculation speed of this method is usually very fast and is suitable for applications that have strict requirements on rendering speed, such as but not limited to application scenarios of smart teaching using smart terminals.

[0036] In the specific implementation, the dot product of the normal and the light source direction can be used to create a fast subsurface scattering algorithm with a simple light transmittance effect. The light transmittance is mainly reflected in the fact that when the light source is on the back of the object, the light can pass through the object and make the object look bright. Therefore, by using the dot product value and adjusting it appropriately, a simple light transmittance effect can be achieved. This method is realistic and efficient enough in real-time rendering applications, and can optimize the visual effect of dark areas.

[0037] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0039] Figure 1 A flowchart of a three-dimensional model rendering method provided in an embodiment of the present application is shown;

[0040] Figure 2 A schematic diagram of three-dimensional model rendering optimization provided by an embodiment of the present application is shown;

[0041] Figure 3 A rendering optimization flow chart in a three-dimensional model rendering method provided in an embodiment of the present application is shown;

[0042] Figure 4 A schematic diagram of the structure of a three-dimensional model rendering device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0044] The terms are explained below.

[0045] 3D, or three-dimensional, refers to a space or object with three dimensions. Unlike two-dimensional (2D), which only has length and width, three-dimensional adds height on this basis, allowing objects to exist and appear in a more real and complex space.

[0046] PBR is a computer graphics technology used to generate realistic images. It simulates the physical principles of light and material interaction in the real world to provide more realistic visual effects.

[0047] Subsurface scattering refers to the process in which light enters the interior of an object from the vertices on the surface of the object and is scattered, and then is transmitted through other vertices on the surface of the object.

[0048] Fast subsurface scattering is a simplified method of subsurface scattering, which achieves a simple subsurface scattering effect with low calculation amount.

[0049] Surface Shader is a shader used to calculate and define the appearance of the surface of a 3D model. It is widely used in computer graphics, game development, and visual effects. It is mainly responsible for simulating the interaction between light and the surface of an object, thereby generating the final image effect presented to the user.

[0050] At present, taking the 3D model of intelligent hardware equipment as an example, the standard PBR technology is usually used to render the 3D model, and PBR focuses on achieving physically correct visual effects, so its flexibility is limited when creating stylized or specialized works of art. In the field of intelligent education, the emotional transmission function of 3D rendering and the information transmission efficiency of educational scenes take precedence over physically correct visual effects, and a comfortable visual experience is more easily accepted in educational scenes. In the process of cooperating with artists to complete the work, it was found that the output using standard PBR technology has the problem of poor visual effects in the dark parts of the model. Therefore, the embodiment of the present application proposes a three-dimensional model rendering optimization scheme based on fast subsurface scattering to improve the rendering effect.

[0051] In practice, the embodiments of the present application can solve the rendering problems of the following scenes: 1. The skin of the image is not rosy enough and the expression looks cold; 2. The clothes of the image are not visually clean enough. To address the above problems, fast subsurface scattering technology is introduced. After completing the basic PBR rendering, the light scattering is calculated in the Surface Shader to optimize the visual effect.

[0052] See also Figure 1 , shows a flow chart of a 3D model rendering method provided by an embodiment of the present application. The 3D model rendering method optimizes the existing PBR rendering and includes the following steps S101-S103.

[0053] S101: Perform basic PBR rendering based on the initial three-dimensional model and the texture to obtain a basic three-dimensional model.

[0054] PBR is physically based rendering, a shading and rendering method that is used to more accurately describe how light interacts with the surface of a model. Due to its high ease of use and convenient workflow, it has been widely used in scenes such as games and teaching.

[0055] PBR rendering usually includes the following main steps: 1 Material definition: PBR materials are usually defined by a set of parameters that describe the physical properties of the material, including albedo, normal map, metallic, roughness, and ambient occlusion, etc.; 2 Geometry processing: Before rendering begins, the geometry in the scene needs to be processed, including vertex transformation, normal calculation, etc.; 3 Lighting calculation: Calculate the impact of direct and indirect light on the material, including diffuse reflection and specular reflection; 4 Shading: Shading is performed according to the calculation results to generate the final image.

[0056] In the specific operation, the PBR material can be assigned to the initial three-dimensional model according to the initial three-dimensional model, and a preset map can be added to the initial three-dimensional model to complete the PBR rendering of the initial three-dimensional model. Among them, the PBR material can be a PBR material with a colloid texture, such as a material with a specific jelly texture, and the colloid texture can be translucent or fully transparent, without limitation. In addition, in the PBR rendering process, the properties of the PBR material can also be set, such as a normal map, self-luminous channel parameters, metalness, roughness, etc., without specific limitation. Among them, the preset map can be a map of a preset surface color, and the preset surface color map can be customized according to different application scenarios. In actual operation, the PBR material can be selected according to the PBR material parameters, wherein the PBR material parameters include one or more of albedo, normal map, metalness, roughness and ambient occlusion, and then, based on different preset surface color maps preset for different scenes, they are added to the initial three-dimensional model of the corresponding scene to obtain a basic three-dimensional model.

[0057] S102: In the surface shader, a simple light-transmitting fast subsurface scattering algorithm is customized based on the dot product of the normal and the light source direction, and the basic three-dimensional model is calculated based on the fast subsurface scattering algorithm to obtain approximate scattering parameters.

[0058] Subsurface Scattering (SSS) is a phenomenon used to simulate the phenomenon that light passes through the surface of an object, scatters inside the object, and then emerges from another surface of the object. This phenomenon can be observed in many natural objects, such as human skin, milk, wax, jelly, marble, etc. In computer graphics, subsurface scattering is a key technology for simulating these objects because it can make objects look more realistic. For example, the soft sheen of human skin when illuminated by light is the result of subsurface scattering. It is also an important technology used in many movies and video games to create realistic characters and environments.

[0059] In practice, there are many renderers that can achieve subsurface scattering effects by rendering for a long time. However, these renderers are not suitable for mobile terminals. In order to achieve subsurface scattering effects on mobile terminals, self-luminescence can be used in the projection area. For example, the result of light scattering in the epidermis can be obtained by performing multiple fuzzy sampling on the map. However, this method will bring too high consumption to the mobile terminal and has a great test on the performance of the mobile terminal.

[0060] It can be seen that the calculation of subsurface scattering is very complicated because it needs to simulate the propagation path of light inside the object, which involves a lot of ray tracing and integral calculations. Therefore, many computer graphics studies are dedicated to finding more efficient subsurface scattering calculation methods.

[0061] In order to solve the time-consuming problem of complex calculations, this embodiment adopts an approximate model, which can be understood as fast subsurface scattering, that is, it does not directly simulate the scattering process of light inside the object, but uses some simplified algorithms to approximate the scattering effect. The accuracy of this method may be low, but its calculation speed is usually very fast, which is suitable for applications with strict requirements on rendering speed, such as but not limited to application scenarios of intelligent teaching using smart terminals.

[0062] The inventor of the present application discovered during the research process that a fast subsurface scattering algorithm can be customized in Surface Shader to achieve simple light transmittance.

[0063] Surface Shader can use specific compilation instructions and structures to define lighting models and surface processing functions, thereby simplifying the processing of lighting and materials. Surface Shader is a type of shader that allows users (developers) to define surface processing functions by using specific compilation instructions (such as #pragma surface) instead of directly writing vertex shaders and fragment shaders. The main purpose of this type of shader is to hide some complex details of lighting and material processing, allowing users to focus more on the logic of surface shaders rather than the underlying rendering details. In SurfaceShader, you can define a function named surf that accepts an Input structure and an inoutSurfaceOutput structure as parameters. The Input structure contains texture coordinates and other necessary variables, while the SurfaceOutput structure is used to output surface properties, such as color, lighting, etc. This approach allows users to more easily control the appearance of the surface while keeping the code concise and maintainable. Surface Shader supports a variety of built-in lighting models, such as Lambert (diffuse reflection) and Blinn-Phong (high light reflection), which are already built into graphics engines such as Unity, allowing users to easily apply these lighting models to their surface shaders. In addition, Surface Shader also supports custom lighting models and parameters, such as transparency and Alpha testing, to meet more complex rendering requirements.

[0064] Therefore, in one implementation, a fast subsurface scattering algorithm with simple light transmittance is customized based on the dot product of the normal and the light source direction in the surface shader, including: in the surface shader, using specific compilation instructions and structures to define the illumination model and the surface processing function; based on the surface processing function, the fast subsurface scattering algorithm based on the dot product of the normal and the light source direction is customized. Wherein, the shader type is Surface Shader, and the surf function is defined in the Surface Shader as the surface processing function, and the surface processing function accepts the Input structure and the inoutSurfaceOutput structure as parameters, wherein the Input structure contains texture coordinates and variables, and the SurfaceOutput structure is used to output surface properties.

[0065] In order to simulate the phenomenon that after light enters an object, it is scattered multiple times inside and finally emerges from the surface, in the embodiment of the present application, the dot product (NdotL) of the normal and the light source direction can be used to create a simple translucency effect. Translucency is mainly reflected in the fact that when the light source is located on the back of an object, the light can pass through the object and make the object look shiny. Therefore, by using the NdotL value and adjusting it appropriately, a simple translucency effect can be achieved. Although this method is not completely accurate, it is realistic and efficient enough in real-time rendering applications.

[0066] Therefore, in one implementation, a fast subsurface scattering algorithm for creating a simple light transmittance effect based on the dot product of the normal and the light source direction is customized in the Surface Shader; based on the fast subsurface scattering algorithm, the dot product between the normal vector of each pixel and the light source direction vector is calculated as the above-mentioned approximate scattering parameter.

[0067] See also Figure 2 , is a schematic diagram of the optimization of 3D model rendering in the embodiment of the present application. First, the initial 3D model is imported; then, the texture is imported; then, basic PBR rendering is performed; then, the Surface Shader calculates fast subsurface scattering; finally, it is output to the screen.

[0068] S103: Rendering and optimizing the basic three-dimensional model according to the approximate scattering parameters, and outputting the optimized three-dimensional model.

[0069] In one implementation, the pixel color of the basic three-dimensional model can be adjusted based on the dot product between the normal vector of each pixel and the light source direction vector, and the light source orientation determined according to the dot product. For example, first, the dot product between the normal vector and the light source direction vector at each pixel is calculated; then, the orientation of the light source relative to the surface is determined according to the dot product value; then, the dot product value is used to adjust the color and / or intensity of the illumination to simulate light transmittance; finally, the adjusted illumination color is combined with the diffuse reflection illumination model to obtain the final pixel color, wherein when the light source is located on the opposite side of the normal, the adjusted illumination color is output as the final color; when the light source is located on the front side of the normal, the diffuse reflection illumination model is used to calculate the diffuse reflection illumination.

[0070] refer to Figure 3 , which are specific implementation steps of the fast subsurface scattering algorithm, including S201-S204.

[0071] S301: Calculate the dot product (NdotL) of the normal and the light source direction.

[0072] Compute the dot product between the normal vector at each pixel and the light direction vector.

[0073] S302: Determine the position of the light source.

[0074] The orientation of the light source relative to the surface, that is, front or back, is determined based on the value of NdotL.

[0075] S303: Adjusting lighting color and / or intensity.

[0076] Use the value of NdotL to adjust the color and intensity of the light to simulate the effect of light transmittance.

[0077] S304: Synthesize the final color.

[0078] Combine the adjusted light color with the diffuse lighting model to get the final pixel color. When the light source is on the back side of the normal, the adjusted light color is output as the final color. When the light source is on the front side of the normal, the conventional diffuse lighting calculation is used.

[0079] In summary, by means of the above technical solutions, a three-dimensional model rendering method, device, medium and equipment provided by the present application customizes a fast subsurface scattering algorithm in the surface shader on the basis of basic PBR rendering to optimize the rendering effect of the three-dimensional model. The solution proposed in the present application can avoid the time-consuming problem of complex calculation of traditional subsurface scattering. Through fast subsurface scattering, that is, not directly simulating the scattering process of light inside the object, but using a fast subsurface scattering algorithm to approximate the scattering effect. The calculation speed of this method is usually very fast and is suitable for applications with strict requirements on rendering speed, such as but not limited to application scenarios of intelligent teaching using smart terminals. In a specific implementation, the dot product of the normal and the light source direction can be used to create a fast subsurface scattering algorithm with a simple light transmission effect, wherein the light transmission is mainly reflected in that when the light source is located on the back of the object, the light can pass through the object and make the object look shiny. Therefore, by using the NdotL value and adjusting it appropriately, a simple light transmission effect can be achieved. Although this method is not completely accurate, it is realistic and efficient enough in real-time rendering applications.

[0080] See also Figure 4 , shows a schematic diagram of the structure of a 3D model rendering device provided in an embodiment of the present application. The 3D model rendering device includes:

[0081] A basic rendering unit 401 is used to perform basic physically based rendering (PBR) based on the initial three-dimensional model and the texture to obtain a basic three-dimensional model;

[0082] A fast subsurface scattering unit 402 is used to create a simple light-transmitting fast subsurface scattering algorithm based on the dot product of the normal and the light source direction in the surface shader, and calculate the basic three-dimensional model based on the fast subsurface scattering algorithm to obtain approximate scattering parameters;

[0083] The rendering optimization unit 403 is used to perform rendering optimization on the basic three-dimensional model according to the approximate scattering parameters and output the optimized three-dimensional model.

[0084] In one implementation,

[0085] The basic rendering unit 401 is specifically used to assign a PBR material to the initial three-dimensional model according to the initial three-dimensional model, and to add a preset map to the initial three-dimensional model to complete the PBR rendering of the initial three-dimensional model.

[0086] In one implementation,

[0087] The basic rendering unit 401 is specifically used to select a PBR material according to PBR material parameters, where the PBR material parameters include one or more of albedo, normal map, metalness, roughness and ambient occlusion; and, based on different preset surface color maps preset for different scenes, add them to the initial three-dimensional model of the corresponding scene to obtain the basic three-dimensional model.

[0088] In one implementation,

[0089] The fast subsurface scattering unit 402 is specifically used for:

[0090] In the surface shader, specific compilation instructions and structures are used to define the illumination model and the surface processing function; based on the surface processing function, the fast subsurface scattering algorithm based on the dot product of the normal and the light source direction is customized.

[0091] In one implementation,

[0092] The shader type is Surface Shader, and a surf function is defined in Surface Shader as the surface processing function. The surface processing function accepts an Input structure and an inoutSurfaceOutput structure as parameters, wherein the Input structure includes texture coordinates and variables, and the SurfaceOutput structure is used to output surface properties.

[0093] In one implementation,

[0094] The rendering optimization unit 403 is specifically configured to adjust the pixel color of the basic three-dimensional model based on the dot product between the normal vector of each pixel and the light source direction vector, and the light source orientation determined according to the dot product.

[0095] In one implementation,

[0096] The rendering optimization unit 403 is specifically used to calculate the dot product between the normal vector and the light source direction vector at each pixel; determine the orientation of the light source relative to the surface based on the dot product value; use the dot product value to adjust the color and intensity of the lighting to simulate light transmittance; combine the adjusted lighting color with the diffuse reflection lighting model to obtain the final pixel color, wherein when the light source is located on the opposite side of the normal, the adjusted lighting color is output as the final color; when the light source is located on the front side of the normal, the diffuse reflection lighting model is used to calculate the diffuse reflection lighting.

[0097] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0098] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0099] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0100] Perform basic physically based rendering (PBR) based on the initial 3D model and texture to obtain a basic 3D model;

[0101] In the surface shader, a fast subsurface scattering algorithm with simple light transmittance is created based on the dot product of the normal and the light source direction, and the basic three-dimensional model is calculated based on the fast subsurface scattering algorithm to obtain approximate scattering parameters;

[0102] The basic three-dimensional model is rendered and optimized according to the approximate scattering parameters, and the optimized three-dimensional model is output.

[0103] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0104] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0105] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0106] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

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

[0108] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0109] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0110] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A three-dimensional model rendering method, characterized in that: include: Perform basic physically based rendering (PBR) based on the initial 3D model and texture to obtain a basic 3D model; In the surface shader, a fast subsurface scattering algorithm with simple light transmittance is created based on the dot product of the normal and the light source direction, and the basic three-dimensional model is calculated based on the fast subsurface scattering algorithm to obtain approximate scattering parameters; The basic three-dimensional model is rendered and optimized according to the approximate scattering parameters, and the optimized three-dimensional model is output.

2. The method according to claim 1, characterized in that The basic PBR rendering is performed based on the initial three-dimensional model and the texture to obtain the basic three-dimensional model, including: According to the initial three-dimensional model, assigning a PBR material to the initial three-dimensional model; A preset map is added to the initial three-dimensional model to complete the PBR rendering of the initial three-dimensional model.

3. The method according to claim 2, characterized in that Assigning a PBR material to the initial three-dimensional model according to the initial three-dimensional model includes: selecting a PBR material according to PBR material parameters, wherein the PBR material parameters include one or more of albedo, normal map, metalness, roughness, and ambient occlusion; The adding of preset textures to the initial three-dimensional model to complete the PBR rendering of the initial three-dimensional model includes: adding different preset surface color textures preset based on different scenes to the initial three-dimensional model of the corresponding scene to obtain the basic three-dimensional model.

4. The method according to claim 1, characterized in that The fast subsurface scattering algorithm for creating simple light transmittance based on the dot product of the normal and the light source direction in the surface shader includes: In the surface shader, specific compilation instructions and structures are used to define a lighting model and a surface processing function; Based on the surface processing function, the fast subsurface scattering algorithm based on the dot product of the normal and the light source direction is customized.

5. The method according to claim 4, characterized in that The shader type is Surface Shader, and a surf function is defined in Surface Shader as the surface processing function. The surface processing function accepts an Input structure and an inoutSurfaceOutput structure as parameters, wherein the Input structure includes texture coordinates and variables, and the SurfaceOutput structure is used to output surface properties.

6. The method according to claim 1, characterized in that The step of calculating the basic three-dimensional model based on the fast subsurface scattering algorithm to obtain approximate scattering parameters includes: Based on the fast subsurface scattering algorithm, the dot product between the normal vector of each pixel of the basic three-dimensional model and the light source direction vector is calculated as the approximate scattering parameter.

7. The method according to claim 6, characterized in that Rendering optimization of the basic three-dimensional model according to the approximate scattering parameters includes: Based on the dot product between the normal vector of each pixel and the light source direction vector, and the light source orientation determined according to the dot product, the pixel color of the basic three-dimensional model is adjusted.

8. The method according to claim 7, characterized in that The step of adjusting the pixel color of the basic three-dimensional model based on the dot product between the normal vector of each pixel and the light source direction vector and the light source orientation determined according to the dot product includes: Calculate the dot product between the normal vector at each pixel and the light source direction vector; Determine the orientation of the light source relative to the surface based on the dot product value; Use dot product values ​​to adjust the color and / or intensity of the lighting to simulate light transmittance; The adjusted lighting color is combined with the diffuse reflection lighting model to obtain the final pixel color. When the light source is on the opposite side of the normal, the adjusted lighting color is output as the final color; when the light source is on the front side of the normal, the diffuse reflection lighting model is used to calculate the diffuse reflection lighting.

9. A three-dimensional model rendering device, characterized in that: include: A basic rendering unit, used for performing basic physically based rendering (PBR) based on the initial three-dimensional model and the texture to obtain a basic three-dimensional model; A fast subsurface scattering unit is used to customize a fast subsurface scattering algorithm for creating simple light transmittance based on the dot product of the normal and the light source direction in the surface shader, and to calculate the basic three-dimensional model based on the fast subsurface scattering algorithm to obtain approximate scattering parameters; A rendering optimization unit is used to perform rendering optimization on the basic three-dimensional model according to the approximate scattering parameters and output the optimized three-dimensional model.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Road pavement simulation method, device, equipment, medium and program product

    CN121327964A

  • Road pavement simulation method, device, equipment, medium and program product

    CN121327964B