Rendering method, device, equipment and medium for subsurface scattering effect

By responding to rendering instructions in the game, obtaining material files and performing lighting intensity calculations, combining Gaussian blur and jitter processing to optimize the subsurface scattering results, the problems of large calculation overhead and distortion of rendering results in the existing technology are solved, and the game picture quality is improved .

CN114581594BActive Publication Date: 2024-12-24BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210210996.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-18
Publication Date
2024-12-24
Estimated Expiration
2040-12-18

AI Technical Summary

Technical Problem

The existing subsurface scattering rendering technology has a high calculation overhead in the game and can easily lead to distortion of rendering results, affecting the view of the picture.

Method used

By responding to rendering instructions, the material file is obtained and the lighting intensity calculation is performed, combined with Gaussian blur and jitter processing, the subsurface scattering results are optimized to reduce calculation overhead and eliminate cross patterns.

Benefits of technology

It effectively reduces the calculation overhead of subsurface scattering rendering, improves game picture quality, eliminates cross patterns and noise, and improves rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114581594B_ABST
    Figure CN114581594B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a rendering method and device, equipment, and medium for subsurface scattering effects. In the method, in response to a rendering instruction input to an image to be rendered, a material file of the image to be rendered is obtained, and a target object to be optimized is selected from the screen space corresponding to the image to be rendered according to the material file, so as to reduce the computational overhead in the rendering process. The illumination intensity is calculated according to the material file to obtain the illumination result of the target object, and the illumination result of the target object is post-processed to obtain the screen space subsurface scattering result of the target object. The post-processing includes Gaussian blur and dithering processing, so as to render the subsurface scattering effect of the target object according to the screen space subsurface scattering result. In the method, the cross pattern and noise can be effectively eliminated by Gaussian blur and dithering processing of the illumination result, so that the subsurface scattering effect of the target object is more delicate, which greatly improves the quality of the game screen.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of game development technology, and in particular to a rendering method, device, equipment and medium for subsurface scattering effect. Background Art

[0002] With the development of image processing technology, the requirements for game image quality are also increasing. In order to meet the image quality requirements of next-generation games, various lighting models need to be proposed to meet the performance requirements of different materials in the game.

[0003] Subsurface scattering refers to the process of light transmission from the vertices on the surface of an object into the interior of the object and then scattering through other vertices on the surface of the object. Subsurface scattering rendering technology can be used to describe the lighting phenomenon of light scattering through the surface of transparent or translucent objects. For example, translucent materials such as jade, marble, candles, and human skin.

[0004] There are many subsurface scattering rendering technologies in the gaming field, which can achieve subsurface scattering effects through long-term rendering. For example, the traditional screen space blur solution can obtain the result of light scattering in the epidermis by performing multiple Gaussian blurs on the texture, but this solution has a high computational overhead (usually up to 12 rendering overheads), which puts a lot of pressure on game screen rendering.

[0005] To this end, a separable subsurface scattering rendering (SSS) scheme has been further proposed to reduce the computational overhead of subsurface scattering rendering (drawing overhead can be reduced to 2 times). However, this scheme can easily lead to distortion of rendering results, causing cross patterns to appear on the game screen, affecting the visual experience of the game screen.

[0006] Therefore, there is an urgent need for a rendering solution for subsurface scattering effect to solve the above problems. Summary of the invention

[0007] Multiple aspects of the present invention provide a method and apparatus, device, and medium for rendering a subsurface scattering effect, which are used to render the subsurface scattering effect in a game screen.

[0008] In the first aspect, an embodiment of the present invention also provides a rendering method for subsurface scattering effects, the method comprising: responding to a rendering instruction input for an image to be rendered, obtaining a material file of the image to be rendered; selecting a target object to be optimized according to the material file from the screen space corresponding to the image to be rendered; calculating the light intensity according to the material file to obtain a lighting result of the target object; performing post-effect processing on the lighting result of the target object to obtain a screen space subsurface scattering result of the target object, wherein the post-effect processing includes Gaussian blur and dithering processing; and rendering the subsurface scattering effect of the target object according to the screen space subsurface scattering result of the target object.

[0009] Further optionally, a target object to be optimized is selected from the screen space corresponding to the image to be rendered according to the material file, including: obtaining shading model information from the material file; selecting multiple pixels matching the shading model information from the screen space, so as to construct the target object through the selected multiple pixels.

[0010] Further optionally, the target object is a target pixel in multiple frames of images.

[0011] If the dithering process is a fixed-direction dithering process, the illumination result of the target object is subjected to post-effect processing, including: determining the corresponding dithering direction according to the noise map; and performing fixed-direction dithering process on the target pixels in multiple frames of images according to the dithering direction corresponding to the noise map, so that the dithering amount of the target pixels in the multiple frames of images is consistent.

[0012] Further optionally, performing illumination intensity calculation according to the material file to obtain the illumination result of the target object includes: inputting the material file into the illumination intensity calculation model, and outputting the illumination result of the target object through the illumination intensity calculation model. The illumination result of the target object includes diffuse reflection illumination result and specular illumination result compressed by a pattern, and the diffuse reflection illumination result includes a transmittance parameter.

[0013] Further optionally, post-effect processing is performed on the illumination result of the target object to obtain a screen-space subsurface scattering result of the target object, including: decompressing the illumination result of the target object into a diffuse illumination result and a specular illumination result; performing Gaussian blur and dithering processing on the target object according to the material file, the decompressed diffuse illumination result, the specular illumination result, and a noise map for dithering processing to obtain a target subsurface scattering result of the target object; and calculating the screen-space subsurface scattering result of the target object according to the scattered color information in the diffuse illumination result, the target subsurface scattering result, and the specular illumination result.

[0014] Among them, further optionally, according to the material file, the decompressed diffuse reflection lighting result, the specular lighting result and the noise map used for dithering processing, Gaussian blur and dithering processing are performed on the target object to obtain the target subsurface scattering result of the target object, including: according to the material file, the decompressed diffuse reflection lighting result and the first noise map, Gaussian blur and dithering processing are performed on the target object in a first direction to obtain the initial subsurface scattering result of the target object; according to the material file, the decompressed specular lighting result and the second noise map, Gaussian blur and dithering processing are performed on the target object in a second direction to obtain the target subsurface scattering result of the target object, wherein the first direction is perpendicular to the second direction.

[0015] The screen space subsurface scattering result of the target object is calculated according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result, including: the screen space subsurface scattering result of the target object is calculated according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result.

[0016] Further optionally, the direction of performing dithering processing on each pixel in the target object is determined according to the first noise map or the second noise map.

[0017] Further optionally, the post-effect processing also includes supersampling anti-aliasing processing, and the supersampling anti-aliasing processing is used to reduce dynamic noise in the target object.

[0018] In a second aspect, an embodiment of the present invention further provides a game editing device, which includes an interaction module, an editing module, and a display interface;

[0019] The interactive module is used to respond to the rendering instruction input to the image to be rendered and obtain the material file of the image to be rendered;

[0020] The editing module is used to select a target object to be optimized from the screen space corresponding to the image to be rendered according to the material file; calculate the light intensity according to the material file to obtain the lighting result of the target object; perform post-effect processing on the lighting result of the target object to obtain the screen space subsurface scattering result of the target object, wherein the post-effect processing includes Gaussian blur and dithering processing; render the subsurface scattering effect of the target object according to the screen space subsurface scattering result of the target object;

[0021] Display interface, used to show the subsurface scattering effect of the target object.

[0022] Further optionally, a material file is input through the interactive module, the material file including shading model information. Furthermore, the editing module is specifically used to: select a plurality of pixels matching the shading model information from the screen space, so as to construct the target object through the selected plurality of pixels.

[0023] Further optionally, the interaction module includes a dither processing state control, and the dither processing state control is used to switch the dither processing type in the editing module, and the dither processing includes random dither processing and fixed-direction dither processing.

[0024] If the jitter processing status control is used to switch to fixed-direction jitter processing, and the target object is a target pixel in multiple-frame images, the editing module will perform post-effect processing on the illumination result of the target object, specifically for: determining the corresponding jitter direction according to the noise map; and performing fixed-direction jitter processing on the target pixels in the multiple-frame images according to the jitter direction corresponding to the noise map, so that the jitter amount of all target pixels in the multiple-frame images is consistent.

[0025] Further optionally, when the editing module calculates the light intensity according to the material file to obtain the light result of the target object, it is specifically used to:

[0026] The material file is input into the illumination intensity calculation model, and the illumination result of the target object is output through the illumination intensity calculation model; wherein the illumination result of the target object includes diffuse reflection illumination result and specular reflection illumination result using Pattern compression, and the diffuse reflection illumination result includes a transmittance parameter.

[0027] Further optionally, when the editing module performs post-effect processing on the illumination result of the target object to obtain the screen space subsurface scattering result of the target object, it is specifically used to:

[0028] The illumination result of the target object is decompressed into diffuse illumination result and specular illumination result; Gaussian blur and dithering are performed on the target object according to the material file, the decompressed diffuse illumination result, the specular illumination result and the noise map used for dithering processing to obtain the target subsurface scattering result of the target object; the screen space subsurface scattering result of the target object is calculated according to the scattered color information in the diffuse illumination result, the target subsurface scattering result and the specular illumination result.

[0029] Further optionally, the editing module performs Gaussian blur and dithering processing on the target object according to the material file, the decompressed diffuse reflection illumination result, the specular illumination result, and the noise map for dithering processing to obtain the target subsurface scattering result of the target object, specifically for:

[0030] According to the material file, the decompressed diffuse reflection illumination result and the first noise map, Gaussian blur and dither processing are performed on the target object in the first direction to obtain the initial subsurface scattering result of the target object; according to the material file, the decompressed specular illumination result and the second noise map, Gaussian blur and dither processing are performed on the target object in the second direction to obtain the target subsurface scattering result of the target object, wherein the first direction is perpendicular to the second direction.

[0031] The editing module calculates the screen space subsurface scattering result of the target object according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result. Specifically, it is used to calculate the screen space subsurface scattering result of the target object according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result.

[0032] Further optionally, the direction of performing the dithering process on each pixel in the target object is determined according to the first noise map or the second noise map.

[0033] Further optionally, the post-effect processing also includes supersampling anti-aliasing processing, and the supersampling anti-aliasing processing is used to reduce dynamic noise in the target object.

[0034] An embodiment of the present invention further provides a system, including a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the rendering method of the subsurface scattering effect described above.

[0035] An embodiment of the present invention provides a computer-readable medium on which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the rendering method of the subsurface scattering effect described above.

[0036] In this embodiment, in response to the rendering instruction input to the image to be rendered, the material file of the image to be rendered is obtained. From the screen space corresponding to the image to be rendered, the target object to be optimized is selected according to the material file, thereby selecting the target object to be rendered from the screen space, so as to implement different rendering processes for the target object to be optimized and the non-target object that does not need to be optimized in the screen space, thereby reducing the computational overhead in the subsequent rendering process. Based on the target object to be optimized, the illumination intensity is calculated according to the material file to obtain the illumination result of the target object, and the illumination result of the target object is post-processed to obtain the screen space subsurface scattering result of the target object, and the post-processing includes Gaussian blur and dithering processing, thereby rendering the subsurface scattering effect of the target object according to the screen space subsurface scattering result. In this embodiment, the Gaussian blur and dithering processing of the illumination result can effectively eliminate the cross pattern and noise, so that the subsurface scattering effect of the target object is more delicate, greatly improving the quality of the game screen. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0038] Figure 1 A schematic flow chart of a method for rendering a subsurface scattering effect provided by an exemplary embodiment of the present invention;

[0039] Figure 2 A schematic diagram of the structure of a game editing device provided by an exemplary embodiment of the present invention;

[0040] Figure 3 A schematic diagram of the structure of another game editing device provided by an exemplary embodiment of the present invention;

[0041] Figure 4 A schematic structural diagram of an electronic device provided by an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0043] The subsurface scattering effect rendering scheme provided in the embodiment of the present invention can be executed by an electronic device, which can be a terminal device such as a smart phone, a tablet computer, a PC, a laptop computer, etc. In an optional embodiment, an application for executing the subsurface scattering effect rendering scheme can be installed on the electronic device. Alternatively, in another optional embodiment, the subsurface scattering effect rendering scheme can also be executed by the server device and the terminal device in cooperation.

[0044] The subsurface scattering effect rendering solution provided by the embodiment of the present invention is applicable to various rendering scenarios, such as game screen editing scenarios, movie screen editing scenarios, and rendering scenarios of transparent or translucent materials in various interfaces. Various transparent or translucent materials are, for example, milk, jade, marble, candles, human skin, etc.

[0045] The following uses the field of games as an example to illustrate the technical problems that the technical solutions provided by the embodiments of the present invention actually solve:

[0046] There are many subsurface scattering rendering technologies in the field of games, and subsurface scattering effects can be achieved by long-term rendering. For example, the traditional screen space blurring solution can obtain the result of light scattering in the epidermis by performing multiple Gaussian blurs on the texture, but this solution has a large computational overhead (usually up to 12 times of drawing overhead), which brings great pressure to the rendering of the game screen. For this reason, a separable subsurface scattering rendering scheme is further proposed to reduce the computational overhead of subsurface scattering rendering (drawing overhead can be reduced to 2 times), but this scheme is prone to distortion of the rendering results, causing cross patterns to appear on the game screen, affecting the look and feel of the game screen. Therefore, there is an urgent need for a rendering scheme for subsurface scattering effects to solve the above problems.

[0047] In view of the above technical problems, a solution is provided in some embodiments of the present invention. The technical solutions provided by the embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0048] The execution process of the rendering method of the subsurface scattering effect is described below in conjunction with the following embodiments. Figure 1 A flowchart of a method for rendering a subsurface scattering effect provided by an embodiment of the present invention. Figure 1 As shown, the rendering method of the subsurface scattering effect includes the following steps:

[0049] 101. Responding to a rendering instruction inputted to an image to be rendered, obtaining a material file of the image to be rendered;

[0050] 102. Selecting a target object to be optimized from the screen space corresponding to the image to be rendered according to the material file;

[0051] 103. Calculate the light intensity according to the material file to obtain the lighting result of the target object;

[0052] 104. Performing post-effect processing on the illumination result of the target object to obtain a screen space subsurface scattering result of the target object, wherein the post-effect processing includes Gaussian blur and dithering processing;

[0053] 105. Render the subsurface scattering effect of the target object according to the screen space subsurface scattering result of the target object.

[0054] The rendering method of the subsurface scattering effect in the embodiment of the present invention is applied to an application, and the application can be set in a device with an image rendering function, such as a game editing application or a game engine.

[0055] Let's take the game field as an example. Figure 1 The various steps in the subsurface scattering effect rendering method are shown below:

[0056] First, in 101, in response to a rendering instruction inputted to the image to be rendered, a material file of the image to be rendered is obtained.

[0057] In some embodiments, the rendering instruction may be triggered by a game developer. For example, in some scenarios, the game developer needs to render a target object composed of transparent or semi-transparent materials in the image to be rendered, and the rendering instruction may be issued through a rendering instruction control provided in the game editing interface. The rendering instruction control may be implemented as a button, a slider, etc., which is not limited in this embodiment.

[0058] In other embodiments, the rendering instruction may be automatically triggered by the game editing application according to a detected event. The event that automatically triggers the rendering instruction may be a timing event, a counting event, or other monitoring event, which is not limited in this embodiment. If it is a timing event, the game editing application may trigger the rendering instruction according to the timed task. For example, in a game screen editing scene, after creating a target object to be rendered, the rendering instruction may be automatically triggered by the game editing application to periodically render the subsurface scattering effect of the target object, or to render the subsurface scattering effect of the target object in real time. They will not be listed one by one.

[0059] After the rendering instruction is detected, the material file of the image to be rendered is received. For example, in a game engine, the material file can be written by a user and imported into the game engine through an interactive interface of the game engine material system. In actual applications, the user can input the material parameters to be edited through the interactive controls (such as list controls, switch controls, input bar controls, slider controls, etc.) provided in the game engine interface to generate a material file based on the material parameters to be edited. Alternatively, the user can also import various information for lighting calculations through input controls in the game engine display interface, and obtain the material file based on the various information for lighting calculations.

[0060] In practical applications, various information used for lighting calculation can be stored in a frame buffer, which can be called a geometry buffer (G-buffer). The material file can be stored through the G-buffer.

[0061] For example, the material file can be stored in three G-buffer maps. Various parameters for calculating the light intensity of subsurface scattering are stored in the G-buffer map, and the various parameters can be obtained through the material system of the game engine (for example, AngelicaX). The material system allows users to customize material files and transmit various parameters of the material files to the game engine for rendering subsurface scattering effects. The material system can be written without mastering the Shader syntax, which can greatly simplify the process of obtaining material files. Among them, the G-buffer maps are recorded as CameraGBufferTexture0, CameraGBufferTexture1, and CameraGBufferTexture2 respectively.

[0062] Among them, the CameraGBufferTexture0 map includes diffuse color information (Diffuse Color), transmittance (Transmittance), and ambient light scattering information (Occlusion). The CameraGBufferTexture1 map includes map information (Specular Lum), subsurface scattering color information (SSS Color), and roughness (Smoothness) for calculating specular illumination. The CameraGBufferTexture2 map includes normal information (Normal), subsurface scattering radius (SSSRadius), and shading model information (Shading Model). The shading model information is, for example, a shading model identifier (ShadingModel ID), which facilitates identification of the material to which each pixel belongs in screen space. The normal information is, for example, the normal information (rg-Normal) of the rg channel in the rgba channel. The form of each information in the G-buffer map is, for example, a floating point data type (float). SSS Radius is used to calculate the information of the scattering part in SSS.

[0063] In 102, a target object to be optimized is selected from the screen space corresponding to the image to be rendered according to the material file. For the purpose of distinction, other objects in the screen space except the target object are referred to as non-target objects in this document.

[0064] In the above steps, optionally, an optional implementation method of selecting a target object to be optimized from the screen space corresponding to the image to be rendered according to the material file is as follows:

[0065] Obtain shading model information from a material file; select multiple pixels matching the shading model information from the screen space to construct a target object using the selected multiple pixels.

[0066] For example, the shading model ID is obtained from the CameraGBufferTexture2 map, and then the pixels corresponding to the shading model ID are queried from the screen space, and the queried multiple pixels are set as the target objects to be optimized. Therefore, the shading model ID can be used to distinguish the pixels to be optimized from the pixels that do not need to be optimized in the screen space, so that different rendering processes can be used for subsequent processing for the pixels to be optimized and the pixels that do not need to be optimized, thereby reducing the amount of calculation in the subsequent rendering process.

[0067] It can be understood that the purpose of this step is to select some objects (such as hair, skin, liquid, etc.) from the screen space that need to show the subsurface scattering rendering effect, so that these objects can be distinguished from other objects in the subsequent processing, so as to reduce the amount of calculation when performing post-effect processing such as Gaussian blur on the screen space.

[0068] Then, after selecting the target object to be optimized, in 103, the illumination intensity is calculated according to the material file to obtain the illumination result of the target object.

[0069] In the above steps, optionally, the illumination intensity is calculated according to the material file to obtain an optional implementation method of the illumination result of the target object, specifically:

[0070] The material file is input into the light intensity calculation model, and the light intensity calculation model is used to output the light result of the target object.

[0071] The illumination result of the target object includes diffuse illumination result and specular illumination result, and the diffuse illumination result includes a transmittance parameter. In order to save video memory space, the diffuse illumination result and the specular illumination result can be compressed using a pattern mode, for example, the output of the rendering target can be reduced. In practical applications, the illumination intensity calculation model is, for example, a lighting calculation model based on physically based rendering (PBR).

[0072] In the above steps, it is assumed that the illumination intensity calculation model is a PBR illumination calculation model. Assuming that the material file is the three G-buffer maps described above, based on the above assumption, the three G-buffer maps are input into the PBR illumination calculation model, and the illumination result of the target object is output through the PBR illumination calculation model, which includes diffuse illumination result and specular illumination result. For example, the illumination result of the target object can be stored in the DiffuseSpecularTex map.

[0073] In fact, for non-target objects, it is also necessary to calculate the light intensity according to the material file to obtain the corresponding lighting result. The specific calculation process can refer to the calculation process of the lighting result of the target object mentioned above, or the traditional lighting result calculation method can be used, which is not limited here.

[0074] In 104, post-effect processing is performed on the illumination result of the target object to obtain a screen space subsurface scattering result of the target object, wherein the post-effect processing includes Gaussian blur and dithering processing.

[0075] In practical applications, before 104, in order to reduce the overall amount of calculation for post-effect processing, the subsurface scattering radius (SSSRadius) of the non-target object can be set to a preset value (e.g., 0) to simplify the amount of calculation when Gaussian blurring the non-target object. Alternatively, the Gaussian blurring of the non-target object can be stopped, and only other post-effect processing, such as dithering, can be performed on the non-target object. In fact, no matter which implementation method is used, it is to reduce the amount of calculation caused by Gaussian blurring of non-target objects, thereby achieving the purpose of reducing the overall amount of calculation.

[0076] In the above step 104, optionally, a post-effect processing is performed on the illumination result of the target object to obtain an optional implementation method of the screen space subsurface scattering result of the target object, specifically:

[0077] Step 1: Decompress the illumination result of the target object into diffuse illumination result and specular illumination result.

[0078] In the above step 1, for example, the illumination result of the target object compressed in the DiffuseSpecularTex map and the CameraGBufferTexture2 map are input into the decompression model, and the illumination result of the target object in the DiffuseSpecularTex map is decompressed by the decompression model into: the diffuse illumination result of the target object and the specular illumination result of the target object.

[0079] In practical applications, in order to reduce the computational overhead of post-processing effects, the shading model identifier can also be obtained from the CameraGBuffer-Texture2 map, and then the lighting results of the pixels corresponding to the shading model identifier can be queried from the DiffuseSpecularTex map, and the lighting results of the queried multiple pixels can be decompressed.

[0080] Step 2: According to the material file, the decompressed diffuse reflection illumination result, the specular illumination result and the noise map used for dithering, Gaussian blur and dithering are performed on the target object to obtain the target subsurface scattering result of the target object.

[0081] Specifically, according to the material file, the decompressed diffuse reflection illumination result and the first noise map, Gaussian blur and dithering processing are performed on the target object in the first direction to obtain an initial subsurface scattering result of the target object.

[0082] For example, assume that the first direction is the x direction. Assume that the material file includes the CameraGBufferTexture1 map and the CameraGBufferTexture2 map. Assume that the CameraGBufferTexture1 map includes the specular map information (r-Specular Lum) of the r channel in the rgba channel, the subsurface scattering color information (gb-SSS Color) of the gb channel, and the roughness (a-Smoothness) of the a channel. Assume that the CameraGBufferTexture2 map includes the normal information (rg-Normal) of the rg channel in the rgba channel, the subsurface scattering radius (b-SSS Radius) of the b channel, and the shading model information (a-Shading Model) of the a channel. Assume that the target object is a pixel in the screen space.

[0083] Based on the above assumptions, according to the b-SSS Radius in the CameraGBufferTexture1 map, the a-Shading Model, the b-SSS Radius in the CameraGBufferTexture2 map, and the MainTex map (i.e., the diffuse reflection illumination result) after decompression in step 1, the pixel is Gaussian blurred in the x direction to calculate the initial subsurface scattering result of the pixel and update it to the MainTex map. Among them, b-SSS Radius is used to calculate the offset during Gaussian blur, a-Shading Model is used to mark pixels belonging to the subsurface scattering material to avoid Gaussian blurring of pixels that do not belong to the subsurface scattering material, and gb-SSS Color is used to calculate the color information of the subsurface scattering effect. Optionally, the direction of the dithering process for each pixel in the target object is determined according to the first noise map. At the same time, the pixel can also be dithered according to the BlueNoiseTex map (i.e., the first noise map) so that the dithering direction of each pixel in the target object is a unified direction determined by the BlueNoiseTex map to avoid the cross pattern appearing in the game screen. In addition, the depth buffer map (such as CameraDepthTexture) can be combined to calculate the initial subsurface scattering result of the pixel.

[0084] Then, according to the material file, the decompressed specular illumination result and the second noise map, Gaussian blur and dither processing are performed on the target object in the second direction to obtain the target subsurface scattering result of the target object. The first direction is perpendicular to the second direction.

[0085] In the above steps, for example, it is assumed that the second direction is the y direction. It is assumed that the material file includes the CameraGBufferTexture0 map, the CameraGBufferTexture1 map, and the CameraGBuf-ferTexture2 map. It is assumed that the CameraGBufferTexture0 map includes the diffuse color information (rg-Diffuse Color) of the rg channel in the rgba channel, the transmittance (b-Transmittance) of the b channel, and the ambient light scattering information (a-Occlusion) of the a channel. It is assumed that the CameraGBufferTexture1 map includes the specular map information (r-Specular Lum) of the r channel in the rgba channel, the subsurface scattering color information (gb-SSS Color) of the gb channel, and the roughness (a-Smoothness) of the a channel. It is assumed that the CameraGBufferTexture2 map includes the normal information (rg-Normal) of the rg channel in the rgba channel, the subsurface scattering radius (b-SSS Radius) of the b channel, and the shading model information (a-ShadingModel) of the a channel. It is assumed that the target object is a pixel in the screen space.

[0086] Based on the above assumptions, according to the rg-Diffuse Color in the CameraGBufferTexture0 map, the gb-SSS Color in the CameraGBufferTexture1 map, the b-SSSRadius in the CameraGBufferTexture2 map, the a-Shading Mode, the SpecularTex map (i.e., the specular lighting result) after decompression in step 1, and the updated MainTex map (i.e., the output result after Gaussian blur in the x direction), the pixel is Gaussian blurred in the y direction to calculate the target subsurface scattering result (Diffuse SSS) of the pixel. Optionally, the direction of the dithering of each pixel in the target object is determined according to the second noise map. At the same time, the pixel can also be dithered according to the BlueNoiseTex map (i.e., the second noise map) so that the dithering direction of each pixel in the target object is a unified direction determined by the BlueNoiseTex map to avoid the cross pattern in the game screen. In addition, the target subsurface scattering result of the pixel can also be calculated in combination with the depth buffer map (e.g., CameraDepthTexture). The first noise map and the second noise map may be the same noise map or different noise maps.

[0087] In actual application, a jitter processing control button is added to the display interface 13, and the button is used to turn on or off the jitter processing of the target object.

[0088] Step 3: Calculate the screen space subsurface scattering result of the target object based on the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result.

[0089] Among them, in step three, the screen space subsurface scattering result of the target object can be calculated in the following way, specifically: multiplying the scattered color information in the diffuse reflection illumination result after decompression in step one by the target subsurface scattering result, and taking the sum of the product and the decompressed specular illumination result as the screen space subsurface scattering result of the target object.

[0090] Through the above steps 1 to 3, not only can the cross pattern and noise be effectively eliminated through post-effect processing, greatly improving the quality of the game screen, but also the material parameters of the subsurface scattering material can be reduced, so as to flexibly adjust various material parameters and improve the rendering efficiency of the subsurface scattering in screen space.

[0091] In the embodiment of the present invention, the dithering process includes random dithering process and fixed direction dithering process. Both the random dithering process and the fixed direction dithering process can eliminate the cross pattern.

[0092] On this basis, the fixed-direction jitter processing can also make the objects after the processing have the same jitter amount. Optionally, this same jitter amount can be randomly determined based on the noise image. From a visual perspective, after the fixed-direction jitter processing, the noise points in each frame of the image no longer change with the change of the image frame, and it can be considered that the same noise point is relatively static in each frame of the image. Since the sensitivity of the human eye to static noise points is much lower than the sensitivity to dynamic noise points, based on this principle, the fixed-direction jitter processing can weaken the visual effect of the noise points in the human eye, thereby achieving the purpose of image noise reduction. For example, through the above-mentioned fixed-direction jitter processing, the noise points in the overlapping part of the skin and hair (such as the hairline) in the game character image are relatively static, weakening the visual effect of this part of the noise points, and achieving the purpose of smooth transition from the skin to the hair part.

[0093] For example, assuming that the target object is a target pixel in multiple frames of images. Based on this, if the dithering process is a fixed-direction dithering process, an optional implementation method of performing post-effect processing on the illumination result of the target object in 104 is: determining a corresponding dithering direction according to the noise map; and performing a fixed-direction dithering process on the target pixel in the multiple frames of images according to the dithering direction corresponding to the noise map, so that the dithering amount of the target pixel in the multiple frames of images is consistent.

[0094] In practical applications, if dynamic noise still exists in the image after the above-mentioned post-effect processing, other noise reduction technologies may be used to further eliminate the noise in the image, such as supersampling anti-aliasing technology. Post-effect processing also includes supersampling anti-aliasing processing, which is used to reduce dynamic noise in the target object. For example, assuming that the target object is a plurality of target pixels, based on this, according to the material file, the diffuse reflection illumination result calculated in the above steps, and the specular illumination result, supersampling anti-aliasing processing is performed on the plurality of target pixels to reduce dynamic noise in the plurality of target pixels.

[0095] In fact, a unified dithering process and super-sampling anti-aliasing process may be applied to the target object and non-target object in the image to be rendered, so as to improve the overall display effect of the image to be rendered.

[0096] Finally, after obtaining the screen space subsurface scattering result through post-effect processing, in 105, the subsurface scattering effect of the target object is rendered according to the screen space subsurface scattering result of the target object.

[0097] Specifically, based on the screen space subsurface scattering result of the target object, each pixel in the target object is rendered to obtain the subsurface scattering effect of the target object. In practical applications, the subsurface scattering effect of the target object can be displayed in a display interface.

[0098] Figure 1 During the execution of the rendering method of the subsurface scattering effect shown, in response to the rendering instruction input to the image to be rendered, the material file of the image to be rendered is obtained. From the screen space corresponding to the image to be rendered, the target object to be optimized is selected according to the material file, so that the target object to be rendered is selected from the screen space, so as to implement different rendering processes for the target object to be optimized and the non-target object that does not need to be optimized in the screen space, thereby reducing the calculation overhead in the subsequent rendering process. On the basis of the target object to be optimized, the illumination result of the target object is obtained by calculating the illumination intensity according to the material file, and the illumination result of the target object is subjected to post-effect processing to obtain the screen space subsurface scattering result of the target object, and the post-effect processing here includes Gaussian blur and dithering processing. Among them, by Gaussian blurring the illumination result, the screen space subsurface scattering result of the target object is made more delicate. In addition, the cross pattern and noise can be effectively eliminated by dithering the illumination result, greatly improving the quality of the game screen. Finally, according to the screen space subsurface scattering result of the target object, the subsurface scattering effect of the target object is rendered.

[0099] The following will describe in detail the rendering device of one or more embodiments of the present invention. Those skilled in the art will appreciate that these rendering devices can be configured using commercially available hardware components through the steps taught in this solution. The rendering device is, for example, a game editing device.

[0100] The embodiment of the present invention also provides a game editing device. Figure 2 A schematic diagram of the structure of a game editing device provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the game editing device includes: an interaction module 11, an editing module 12, and a display interface 13.

[0101] The interactive module 11 is used to respond to the rendering instruction inputted to the image to be rendered and obtain the material file of the image to be rendered;

[0102] The editing module 12 is used to select a target object to be optimized from the screen space corresponding to the image to be rendered according to the material file; calculate the illumination intensity according to the material file to obtain the illumination result of the target object; perform post-effect processing on the illumination result of the target object to obtain the screen space subsurface scattering result of the target object, wherein the post-effect processing includes Gaussian blur and dithering processing; render the subsurface scattering effect of the target object according to the screen space subsurface scattering result of the target object;

[0103] The display interface 13 is used to display the subsurface scattering effect of the target object.

[0104] In practical applications, the game editing device is, for example, a game engine. In the game engine, the interactive module 11 is implemented as an interactive control in the display interface 13, and the editing module 12 is implemented as various logic programs in the background of the game engine. Figure 3 As shown, in Figure 3 In the example, the interactive module 11 includes an interactive control 110, an interactive control 111, and an interactive control 112. The interactive controls are, for example, an input field, a slider control, a button, and a list selection control.

[0105] Optionally, a material file including shading model information is input through the interaction module 11. Furthermore, the editing module 12 is specifically used to select a plurality of pixels matching the shading model information from the screen space, so as to construct a target object through the selected plurality of pixels.

[0106] Optionally, the interaction module 11 includes a dither processing state control, and the dither processing state control is used to switch the dither processing type in the editing module, and the dither processing includes random dither processing and fixed-direction dither processing.

[0107] If the jitter processing status control is switched to fixed-direction jitter processing, and the target object is a target pixel in a multi-frame image, then when the editing module 12 performs post-effect processing on the illumination result of the target object, it is specifically used to: determine the corresponding jitter direction according to the noise map; and perform fixed-direction jitter processing on the target pixels in the multi-frame images according to the jitter direction corresponding to the noise map, so that the jitter amount of all target pixels in the multi-frame images is consistent.

[0108] The jitter processing state control can be implemented using a Boolean variable. For example, assume that a jitter processing state control is set in the display interface of a game editing device. The jitter processing state control is associated with a bool variable in the game editing device, and then the jitter processing type in the post-effect processing is controlled by the bool variable. For example, after entering the fixed direction jitter processing, the jitter amount of each pixel is fixed and no longer changes with the image frame.

[0109] Optionally, when the editing module 12 calculates the illumination intensity according to the material file to obtain the illumination result of the target object, it is specifically used to:

[0110] The material file is input into the illumination intensity calculation model, and the illumination result of the target object is output through the illumination intensity calculation model; wherein the illumination result of the target object includes diffuse reflection illumination result and specular reflection illumination result compressed by the Pattern mode, and the diffuse reflection illumination result includes a transmittance parameter.

[0111] Optionally, when the editing module 12 performs post-effect processing on the illumination result of the target object to obtain the screen space subsurface scattering result of the target object, it is specifically used to:

[0112] The illumination result of the target object is decompressed into diffuse illumination result and specular illumination result; Gaussian blur and dithering are performed on the target object according to the material file, the decompressed diffuse illumination result, the specular illumination result and the noise map used for dithering processing to obtain the target subsurface scattering result of the target object; the screen space subsurface scattering result of the target object is calculated according to the scattered color information in the diffuse illumination result, the target subsurface scattering result and the specular illumination result.

[0113] Optionally, the editing module 12 performs Gaussian blur and dithering processing on the target object according to the material file, the decompressed diffuse reflection illumination result, the specular illumination result, and the noise map for dithering processing to obtain the target subsurface scattering result of the target object, specifically for:

[0114] According to the material file, the decompressed diffuse reflection illumination result and the first noise map, Gaussian blur and dither processing are performed on the target object in the first direction to obtain the initial subsurface scattering result of the target object; according to the material file, the decompressed specular illumination result and the second noise map, Gaussian blur and dither processing are performed on the target object in the second direction to obtain the target subsurface scattering result of the target object, wherein the first direction is perpendicular to the second direction.

[0115] When the editing module 12 calculates the screen space subsurface scattering result of the target object according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result, it is specifically used to calculate the screen space subsurface scattering result of the target object according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result.

[0116] Optionally, the direction of performing dithering processing on each pixel in the target object is determined according to the first noise map or the second noise map.

[0117] Optionally, the post-effect processing further includes supersampling anti-aliasing processing, and the supersampling anti-aliasing processing is used to eliminate dynamic noise in the target object.

[0118] Figure 2 In the game editing device shown, through the cooperation of the interactive module 11, the editing module 12 and the display interface 13, first, in the interactive module 11, the rendering instruction input to the image to be rendered is responded to, and the material file of the image to be rendered is obtained. The target object to be optimized is selected from the screen space corresponding to the image to be rendered according to the material file through the editing module 12, so that the target object to be rendered is selected from the screen space, so that different rendering processes are implemented for the target object to be optimized and the non-target object that does not need to be optimized in the screen space, thereby reducing the calculation overhead in the subsequent rendering process. On the basis of the target object to be optimized, the illumination intensity is calculated according to the material file to obtain the illumination result of the target object, and the illumination result of the target object is post-processed to obtain the screen space subsurface scattering result of the target object to render the subsurface scattering effect of the target object. The post-effect processing here includes Gaussian blur and dithering processing. Among them, by Gaussian blurring the illumination result, the screen space subsurface scattering result of the target object is made more delicate. In addition, the cross pattern and noise can be effectively eliminated by dithering the illumination result, greatly improving the quality of the game screen. Finally, the subsurface scattering effect of the target object is displayed in the display interface 13 .

[0119] Figure 2 The game editing device shown can execute the methods provided in the aforementioned embodiments. For the parts not described in detail in this embodiment, please refer to the relevant description of the aforementioned embodiments and will not be repeated here.

[0120] In one possible design, the above Figure 2 The game editing device shown can be installed in an electronic device. Figure 2 The game editing device shown can also be implemented as an electronic device.

[0121] like Figure 4 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 stores executable code, and when the executable code is executed by the processor 21, at least the processor 21 can implement the rendering method of the subsurface scattering effect provided in the above-mentioned embodiment. The structure of the electronic device may also include a communication interface 23 for communicating with other devices or communication networks.

[0122] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0123] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0124] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0126] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0127] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0128] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0129] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0130] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A rendering method for subsurface scattering effect, characterized in that: include: For a target object to be optimized in the screen space corresponding to the image to be rendered, decompressing the illumination result of the target object into a diffuse illumination result and a specular illumination result; According to the material file of the image to be rendered, the decompressed diffuse reflection illumination result, the specular illumination result, and the noise map used for dithering, Gaussian blur and dithering are performed on the target object to obtain a target subsurface scattering result of the target object; Calculating a screen space subsurface scattering result of the target object according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result, and the specular illumination result; The subsurface scattering effect of the target object is rendered according to the screen space subsurface scattering result of the target object.

2. The method according to claim 1, characterized in that The target object is a target pixel in multiple frames of images; If the jitter processing is a fixed-direction jitter processing, then the jitter processing on the target object includes: Determine a corresponding shaking direction according to the noise map; According to the jitter direction corresponding to the noise map, a fixed-direction jitter process is performed on the target pixels in the multiple frames of images, so that the jitter amounts of the target pixels in the multiple frames of images are consistent.

3. The method according to claim 1, characterized in that: The step of performing Gaussian blur and dithering processing on the target object according to the material file of the image to be rendered, the decompressed diffuse reflection illumination result, the specular illumination result, and the noise map for dithering processing to obtain a target subsurface scattering result of the target object includes: According to the material file, the decompressed diffuse reflection illumination result and the first noise map, Gaussian blur and dither processing are performed on the target object in a first direction to obtain an initial subsurface scattering result of the target object; According to the material file, the decompressed specular illumination result and the second noise map, Gaussian blur and dither processing are performed on the target object in a second direction to obtain a target subsurface scattering result of the target object, wherein the first direction is perpendicular to the second direction; The calculating, according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result, a screen space subsurface scattering result of the target object comprises: The screen space subsurface scattering result of the target object is calculated according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result and the specular illumination result.

4. The method according to claim 3, characterized in that The direction of performing dithering processing on each pixel in the target object is determined according to the first noise map or the second noise map.

5. The method according to any one of claims 1 to 4, characterized in that: Also includes: A supersampling anti-aliasing process is performed on the illumination result of the target object, where the supersampling anti-aliasing process is used to reduce dynamic noise in the target object.

6. A game editing device, characterized in that: The game editing device includes an editing module and a display interface; in The editing module is used to decompress the illumination result of the target object to be optimized in the screen space corresponding to the image to be rendered into a diffuse illumination result and a specular illumination result; According to the material file of the image to be rendered, the decompressed diffuse reflection illumination result, the specular illumination result, and the noise map used for dithering, Gaussian blur and dithering are performed on the target object to obtain a target subsurface scattering result of the target object; Calculating a screen space subsurface scattering result of the target object according to the scattered color information in the diffuse reflection illumination result, the target subsurface scattering result, and the specular illumination result; Rendering a subsurface scattering effect of the target object according to a screen space subsurface scattering result of the target object; The display interface is used to display the subsurface scattering effect of the target object.

7. An electronic device, characterized in that: include: Memory and processor; The memory is used to store one or more computer instructions; The processor is configured to execute the one or more computer instructions for: executing the method according to any one of claims 1-5.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, the method according to any one of claims 1 to 5 can be implemented.