Image drawing method and electronic equipment

By using photon maps and PBD models in the image drawing method to calculate the subsurface scattering results, the problem of inaccurate light transmission and reflection simulation in the prior art is solved, which improves the authenticity and accuracy of the image and improves the user experience.

CN119027571APending Publication Date: 2024-11-26HUAWEI TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310595935.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-23
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The prior art cannot truly simulate the transmission and reflection of light in translucent materials and scattering media, resulting in inaccurate image drawing, poor accuracy, and correspondingly lower user immersion and experience quality.

Method used

An image drawing method is adopted to calculate photon maps and shadow maps by obtaining light source information and object information in the world space. Combined with the PBD model, considering the refractive direction of light on the surface of the object, calculate the subsurface scattering results, and according to diffuse reflection and Highlight results draw images to improve the authenticity and accuracy of the image.

Benefits of technology

It significantly improves the authenticity and accuracy of the image, enhances the user's immersion and experience quality, and can render the effects of translucent materials and scattering media more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119027571A_ABST
    Figure CN119027571A_ABST
Patent Text Reader

Abstract

The invention discloses an image drawing method and electronic equipment. The electronic equipment acquires light source information and information of a first object in a world space. And the electronic equipment obtains a photon map according to the light source information and the information of the object, wherein the photon map comprises position information and intensity information of each point on the surface of the object and direction information of light refracted on the surface of the object. The electronic device obtains the normal and position information of each coloring point of the object in the screen space. And the electronic equipment obtains the position information, direction and light intensity of each photon beam of each coloring point according to the normal and position information of each coloring point and the photon map. And the electronic equipment determines a subsurface scattering result of the object according to the position information, the direction and the light intensity of each photon beam so as to draw an image of the object. The electronic equipment obtains the photon map and obtains the color value of each coloring point of the object by using the direction information of the light in the photon map after refraction on the surface of the object, so that the accuracy is high, and the drawn image has higher immersion and experience quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of electronic devices, and in particular to an image drawing method and an electronic device. Background Art

[0002] Electronic devices need to display user interfaces after image drawing. This is aimed at scenes that require real-time image drawing, such as game scenes, simulation scenes, and virtual reality interaction scenes. In these scenes, there are some objects with translucent materials or scattering media, such as milk, jade, marble, and skin. These objects may involve the transmission of light inside the object and the reflection of the object outside. The current image drawing method cannot truly simulate the transmission of light. Therefore, the images drawn by the current image drawing method are not realistic enough, the accuracy is poor, and the user's immersion and experience quality are poor. Summary of the invention

[0003] An image drawing method and electronic device provided in the embodiments of the present application can improve the authenticity and accuracy of images.

[0004] In order to achieve the above-mentioned purpose, the embodiment of the present application adopts the following technical solution.

[0005] In a first aspect, the present application provides an image drawing method, the execution subject of the method may be an electronic device, or a component located in the electronic device (for example, a chip, a chip system or a processor, etc.), and the following description is made by taking the execution subject as an electronic device as an example. The method may include: the electronic device obtains light source information and information of a first object in world space. The information of the first object includes material properties, and the material properties include translucent materials and materials with scattering functions. The information of the first object also includes position information of each point on the surface of the first object. The electronic device obtains the diffuse reflection result, highlight result and photon map of the first object based on the light source information and the information of the first object, and the photon map includes the position information of each point on the surface of the first object, the intensity information and the direction information of the light after refraction on the surface of the first object. The electronic device obtains the normal and position information of each shading point on the first object in the screen space. The electronic device determines the color value of each shading point based on the normal and position information of each shading point and the photon map to obtain the subsurface scattering result of the first object. The electronic device draws the image of the first object based on the subsurface scattering result, the diffuse reflection result and the highlight result.

[0006] Thus, in the present application, the electronic device obtains the light source information and the information of the first object in the world space. The electronic device obtains the photon map based on the light source information and the object information. The photon map includes the position information, intensity information and direction information of each point on the surface of the object after the light is refracted on the surface of the object. The electronic device obtains the normal and position information of each shading point of the object in the screen space. The electronic device obtains the position information, direction and light intensity of each photon beam of each shading point based on the normal and position information of each shading point and the photon map. The electronic device determines the subsurface scattering result of the object based on the position information, direction and light intensity of each photon beam to draw an image of the object. The electronic device obtains the photon map and obtains the color value of each shading point of the object by using the direction information of the light after refraction on the surface of the object in the photon map, with high accuracy, so that the drawn image has a high sense of immersion and experience quality.

[0007] In one design solution, the electronic device determines the color value of each shading point according to the normal and position information of each shading point and the photon map to obtain the subsurface scattering result of the first object. Specifically, the electronic device obtains the position information, direction and light intensity of each photon beam corresponding to each shading point according to the normal and position information of each shading point and the photon map. The electronic device determines the color value of each shading point according to the position information, direction and light intensity of each photon beam to obtain the subsurface scattering result of the first object.

[0008] In one design scheme, the electronic device determines the color value of each shading point according to the position information, direction and light intensity of each photon beam to obtain the subsurface scattering result of the first object. Specifically, the electronic device calculates the first color value of the first photon beam for the first shading point in the screen space according to the photon beam PBD model. The electronic device determines the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam. After determining the parameters of the PBD model, the electronic device obtains the color value of each shading point of the first object for each photon beam in the screen space according to the PBD model. The electronic device obtains the subsurface scattering result of the first object according to the color values ​​of multiple shading points of the first object.

[0009] In this application, by adopting the PBD model, the directional information of light after refraction on the surface of the object is taken into account in the photon map, that is, the refraction direction of light at the surface point of the object is taken into account, which significantly improves the accuracy of the results and makes both backlight transmission and front scattering more accurately drawn.

[0010] In one design, the parameters of the PBD model may include: the distance from the real source to the first shading point, the distance from the virtual source to the first shading point, the depth of the real source, and the depth of the virtual source. The real source is each photon in the first photon beam. The distance from the real source to the first shading point is the distance between each photon in the first photon beam and the first shading point. The depth of the real source is obtained based on the distance from the real source to the first shading point. The virtual source is each photon in the theoretical photon beam. The distance from the virtual source to the first shading point is determined based on the depth of the real source. The depth of the virtual source is determined based on the depth of the real source.

[0011] In one design solution, the electronic device obtains the color value of each shading point of the first object for each photon beam in the screen space according to the PBD model. Specifically, the electronic device obtains the second color value and its weight for the second shading point for the second photon beam in the screen space according to the PBD model. The electronic device obtains the third color value and its weight for the third shading point for the third photon beam in the screen space according to the PBD model. The electronic device determines the final color value of the first shading point according to the first color value, the second color value and its weight, and the third color value and its weight.

[0012] In the present application, the final color value of the first shading point is obtained by considering the influence of other photon beams on the color value of the first shading point and calculating the weight of the other photon beams on the color value of the first shading point and the color value of the corresponding shading point, so that the final color value is more accurate and the resulting image is more realistic.

[0013] In some designs, the method may further include: the electronic device adjusts the parameters of the PBD model according to the subsurface scattering result of the first object and the near surface correction factor; the near surface correction factor is used to correct the overestimation of near surface photons. In this way, the electronic device can eliminate the model error caused by the photon position according to the first color value and the near surface correction factor.

[0014] In some design solutions, the method may further include: the electronic device adjusts the parameters of the PBD model according to the subsurface scattering result of the first object and the extinction coefficient correction factor; the extinction coefficient correction factor is used to correct the error caused by the change of the extinction coefficient. In this way, the electronic device can eliminate the model error caused by the change of the extinction coefficient according to the above-mentioned first color value and the extinction coefficient correction factor.

[0015] In some design solutions, the method may further include: the electronic device adjusts the parameters of the PBD model according to the subsurface scattering result of the first object and the single scattering rate correction factor; the single scattering rate correction factor is used to correct the error caused by the change of the single scattering rate. In this way, the electronic device can correct the model error caused by the change of the single scattering rate according to the above-mentioned first color value and the single scattering rate, thereby eliminating the model error caused by the change of the single scattering rate.

[0016] In a second aspect, the present application provides an electronic device that may include: an acquisition module, a determination module, and a drawing module; wherein:

[0017] The acquisition module is used to acquire the light source information and the information of the first object in the world space; the information of the first object includes material properties, and the material properties include translucent materials and materials with scattering functions; the information of the first object also includes the position information of each point on the surface of the first object. The acquisition module is used to acquire the diffuse reflection result, highlight result and photon map of the first object according to the light source information and the information of the first object, and the photon map includes the position information, intensity information and direction information of the light after refraction on the surface of the first object at each point on the surface of the first object. The acquisition module is used to acquire the normal and position information of each shading point on the first object in the screen space. The determination module is used to determine the color value of each shading point according to the normal and position information of each shading point and the photon map, so as to obtain the subsurface scattering result of the first object. The drawing module is used to draw the image of the first object according to the subsurface scattering result, diffuse reflection result and highlight result.

[0018] Thus, in the present application, the electronic device obtains the light source information and the information of the first object in the world space. The electronic device obtains the photon map based on the light source information and the object information. The photon map includes the position information, intensity information and direction information of each point on the surface of the object after the light is refracted on the surface of the object. The electronic device obtains the normal and position information of each shading point of the object in the screen space. The electronic device obtains the position information, direction and light intensity of each photon beam of each shading point based on the normal and position information of each shading point and the photon map. The electronic device determines the subsurface scattering result of the object based on the position information, direction and light intensity of each photon beam to draw an image of the object. The electronic device obtains the photon map and obtains the color value of each shading point of the object by using the direction information of the light after refraction on the surface of the object in the photon map, with high accuracy, so that the drawn image has a high sense of immersion and experience quality.

[0019] In one design scheme, the determination module is used to: obtain the position information, direction and light intensity of each photon beam corresponding to each shading point based on the normal and position information of each shading point, and the photon map; determine the color value of each shading point based on the position information, direction and light intensity of each photon beam to obtain the sub-surface scattering result of the first object.

[0020] In one design, the determination module is used to: calculate the first color value of the first photon beam to the first shading point in the screen space according to the photon beam PBD model; determine the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam; after determining the parameters of the PBD model, obtain the color values ​​of each shading point of the first object in the screen space according to each photon beam according to the PBD model; obtain the subsurface scattering result of the first object according to the color values ​​of multiple shading points of the first object. In the present application, by adopting the PBD model, the directional information of the light after refraction on the surface of the object is taken into account in the photon map, that is, the refraction direction of the light at the surface point of the object is taken into account, which significantly improves the accuracy of the result, and more accurately draws both the backlight transmission and the front scattering.

[0021] In one design, the parameters of the PBD model include: the distance from the real source to the first shading point, the distance from the virtual source to the first shading point, the depth of the real source, and the depth of the virtual source. The real source is each photon in the first photon beam. The distance from the real source to the first shading point is the distance between each photon in the first photon beam and the first shading point. The depth of the real source is obtained based on the distance from the real source to the first shading point. The virtual source is each photon in the theoretical photon beam; the distance from the virtual source to the first shading point is determined based on the depth of the real source. The depth of the virtual source is determined based on the depth of the real source.

[0022] In one design scheme, the acquisition module is used to: acquire the second color value and its weight of the second shading point of the second photon beam in the screen space according to the PBD model; acquire the third color value and its weight of the third shading point of the third photon beam in the screen space according to the PBD model; determine the final color value of the first shading point according to the first color value, the second color value and its weight, and the third color value and its weight.

[0023] In the present application, the final color value of the first shading point is obtained by considering the influence of other photon beams on the color value of the first shading point and calculating the weight of the other photon beams on the color value of the first shading point and the color value of the corresponding shading point, so that the final color value is more accurate and the resulting image is more realistic.

[0024] In one design solution, the electronic device may further include: an adjustment module, the adjustment module being used to: adjust the parameters of the PBD model according to the subsurface scattering result of the first object and the near-surface correction factor; the near-surface correction factor being used to correct the overestimation of near-surface photons. In this way, the electronic device can eliminate the model error caused by the photon position according to the first color value and the near-surface correction factor.

[0025] In one design solution, the adjustment module is further used to adjust the parameters of the PBD model according to the subsurface scattering result of the first object and the extinction coefficient correction factor; the extinction coefficient correction factor is used to correct the error caused by the change of the extinction coefficient. In this way, the electronic device can eliminate the model error caused by the change of the extinction coefficient according to the above-mentioned first color value and the extinction coefficient correction factor.

[0026] In one design solution, the adjustment module is further used to adjust the parameters of the PBD model according to the subsurface scattering result of the first object and the single scattering rate correction factor; the single scattering rate correction factor is used to correct the error caused by the change of the single scattering rate. In this way, the electronic device can correct the model error caused by the change of the single scattering rate according to the first color value and the single scattering rate.

[0027] In a third aspect, the present application provides an electronic device, comprising: one or more processors; and a memory, wherein the memory stores a code; when the code is executed by the processor, the electronic device executes the method described in the first aspect.

[0028] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect.

[0029] In a fifth aspect, the present application provides a chip system comprising one or more processors. When the one or more processors execute instructions, the one or more processors execute the method described in the first aspect.

[0030] Among them, the specific implementation methods and corresponding technical effects of each of the second to fifth aspects mentioned above can refer to the specific implementation methods and technical effects of the first aspect mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A flowchart of an image drawing method is provided;

[0032] Figure 2 A flowchart of another image drawing method is provided;

[0033] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0034] Figure 4 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application;

[0035] Figure 5-1 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application;

[0036] Figure 5-2 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application;

[0037] Figure 5-3 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application;

[0038] Figure 6 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application;

[0039] Figure 7 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application in an application scenario;

[0040] Figure 8 A schematic diagram of the rendering effect of an image drawing method provided in an embodiment of the present application;

[0041] Fig. 9 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] Electronic devices need to display user interfaces after image rendering. For scenes that require real-time image rendering, such as game scenes, simulation scenes, and virtual reality interaction scenes. In these scenes, there are some translucent objects or scattering media, such as milk, jade, marble, and skin. These objects may involve the transmission of light inside the object and the reflection of light outside the object.

[0043] In one case, an electronic device can simulate the transmission of light on an object based on a bidirectional reflectance distribution function (BRDF) (or BRDF model). Since the BRDF model simulates the external appearance of an object based on the reflection and refraction of light, it can be seen that the BRDF model cannot describe the transmission and reflection of light very well. Therefore, the image drawn by the image drawing method in this scenario is not realistic enough, has poor accuracy, and the user's immersion and experience quality are poor.

[0044] In order to improve the accuracy of rendering, it is necessary to consider more complex subsurface scattering models, such as the bidirectional scattering surface reflectance distribution function (BSSRDF) model. The BSSRDF model can more realistically simulate the transmission of light inside the material, so it can better present the effect of translucent materials. This model needs to take into account the absorption, scattering and reflection properties of the material, and use a series of mathematical formulas to describe these properties. The implementation of the BSSRDF model requires a high degree of computing resources and algorithm optimization, but after implementation, it can greatly improve the realism and accuracy of rendering, thereby improving the user's immersion and experience quality.

[0045] In order to render translucent materials at real-time rates, many mainstream rendering engines in the industry, such as Unity and UE4, have adopted subsurface scattering algorithms based on screen space to improve rendering efficiency and speed. The screen space can be understood as a two-dimensional space on a computer screen. The screen space algorithm filters the screen rendering results in a post-processing manner to simulate the detail reduction and lighting diffusion effects of translucent materials. It generally adopts a distance-dependent BSSRDF model, among which the most representative works are the separable subsurface scattering (SSSS) model of Jimenez et al. and the normalized profile model of Christensen et al. The main advantage of the subsurface scattering algorithm based on screen space is that it runs faster, because it can reduce the calculation of non-important areas in the scene and can use the parallel computing power of the GPU to accelerate the calculation process. This enables the algorithm based on screen space to be widely used in real-time applications, such as rendering realistic translucent materials such as human skin, blood, and candles in games.

[0046] In another case, electronic devices can use the screen-space translucency material algorithm mainly used in Unity and UE4 engines. This technology performs all light transport calculations normally in screen space, using the normalized profile model of Christensen et al., and filters the entire screen space as a post-processing method to simulate subsurface scattering. For the calculation of long-distance scattering and backlight sources, this technology uses the Real-timerealistic skin translucency algorithm proposed by Jimenez et al. to add additional missing transmission effects.

[0047] Figure 1 A flowchart of an image drawing method is shown in FIG. Figure 1As shown, the electronic device obtains the interface information of the application, and the interface information may include the light source information and the object information in the world space. The world space can be understood as a three-dimensional space used to represent the three-dimensional space coordinates of the object. The electronic device obtains the shadow map, transmission results, highlight results and reflected light results based on the light source information and the object information. Afterwards, the electronic device can obtain the position of the light source in the screen space and the subsurface scattering results of the light source on the object shading point through the BSSRDF model. The electronic device draws the image of the object based on the subsurface scattering results, transmission results, highlight results and reflected light results. In this way, the method can effectively realize the real-time rendering function of translucent materials and solve the high time-consuming problem of subsurface scattering. However, there is still a problem of insufficient accuracy of the subsurface scattering calculation results.

[0048] In another case, compared with the above case, the difference is that: Figure 2 As shown, the electronic device obtains a shadow map in the world space. The electronic device stores the position, normal and intensity information of the object surface in the world space. The electronic device constructs a splats map based on the position, normal and intensity information of the object surface. The electronic device obtains the subsurface scattering results of the light source on the object's shading points based on the splats map and the BSSRDF model. The electronic device draws an image of the object based on the subsurface scattering results, highlight results and reflected light results. In this way, the method has a high accuracy of subsurface scattering calculation, but there is still a problem of insufficient accuracy of the subsurface scattering calculation results. Moreover, the electronic device uses the splats map to connect the light source space with the shading points on the screen space, and the construction of splats causes excessive rendering rate loss.

[0049] In order to solve the above technical problems, the present application provides an image drawing method, which includes: an electronic device obtains light source information and information of a first object in a world space. The information of the first object includes material properties, and the material properties may include a translucent material and a material with a scattering function. The information of the first object may also include position information of each point on the surface of the first object. The electronic device obtains a photon map and a shadow map according to the light source information and the information of the first object, and the photon map includes position information, intensity information and direction information of light after refraction on the surface of the object at each point on the surface of the object. The shadow map is used to characterize the shadow information of the first object. The electronic device obtains the normal and position information of each shading point on the first object in the screen space. The electronic device obtains the position information, direction and light intensity of each photon beam corresponding to each shading point according to the normal and position information of each shading point and the photon map. The electronic device determines the color value of each shading point according to the position information, direction and light intensity of each photon beam to obtain the subsurface scattering result of the first object. The electronic device obtains the diffuse reflection result and the highlight result of the first object. The electronic device draws the image of the first object according to the subsurface scattering result, the diffuse reflection result and the highlight result. In this way, the electronic device obtains the photon map and uses the directional information of light after refraction on the surface of the object in the photon map to obtain the color value of each shading point of the object with high accuracy, making the drawn image have a higher sense of immersion and experience quality.

[0050] Figure 3 It is a structural block diagram of the above electronic equipment.

[0051] like Figure 3 As shown, the electronic device 100 may include a processor 110, a memory 120, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, a wireless communication module 160, a sensor module 150, and a display screen 170, etc.

[0052] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0053] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0054] In some examples, the GPU is used to efficiently draw three-dimensional model data on the desktop through a rendering pipeline.

[0055] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0056] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0057] In some examples, the processor 110 performs rendering process construction and data processing. Exemplarily, the processor 110 can adopt the Kirin 9000 processor.

[0058] In some examples, the program code of the image drawing method provided by the present application can be stored in the runtime engine, memory management, and rendering pipeline process of the platform software. Figure 4 As shown, at runtime, the program code of the present application runs in the host memory and GPU memory of the electronic device. Figure 4 The implementation form of the present application in computer and platform software is given, wherein the portion shown in the dashed box is the module modified by the present application on the existing GPU rendering architecture. Inside the geometry stage module 4011, the present application modifies the vertex shader 4012 module to process the additional vertex information of the semi-transparent object; in the rasterization stage 4017 module, the present application modifies the geometry shader module to allow the calculation of various semi-transparent material rendering operations including photon map construction, PBD model evaluation, texture filtering, etc.

[0059] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of an electronic device. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0060] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the memory 120, the display screen 170, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0061] The wireless communication function of the electronic device can be implemented through the antenna 1, the wireless communication module 160, the modem processor and the baseband processor.

[0062] Antenna 1 is used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0063] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 1, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 1.

[0064] The electronic device implements the display function through a GPU, a display screen 170, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 170 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0065] The display screen 170 is used to display images, videos, etc. The display screen 170 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 170, where N is a positive integer greater than 1.

[0066] The electronic device can realize the shooting function through an ISP, a video codec, a GPU, a display screen 170, and an application processor.

[0067] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency point, a digital signal processor is used to perform Fourier transform on the frequency point energy.

[0068] Video codecs are used to compress or decompress digital videos. Electronic devices can support one or more video codecs. In this way, electronic devices can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0069] The memory 120 may be used to store computer executable program codes, which include instructions. The internal memory 120 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc.

[0070] Of course, the electronic device may also include other functional units, which are not limited in the embodiments of the present application.

[0071] Below Figure 3 Taking the structure shown in the figure as an example, the image drawing method provided by the embodiment of the present application is described. Each unit in the following embodiment may have Figure 3 It should be noted that the message names or parameter names in the messages exchanged between the devices in the embodiments of the present application are only examples, and other names may be used in the specific implementation. In addition, the actions, terms, etc. involved in the embodiments of the present application may refer to each other without limitation.

[0072] The following is a detailed introduction to an image drawing method provided in an embodiment of the present application.

[0073] Figure 5-1 to Figure 5-3 A schematic diagram of a flow chart of an image drawing method provided in an embodiment of the present application. Figure 5-1 and Figure 5-3 As shown, the method may include:

[0074] S500: The electronic device receives an operation on a first application by a user.

[0075] The first application may be any type of application, in particular a game application, a simulation application, a virtual reality interactive application, etc. The user interface of the first application is a scene interface in the world space.

[0076] The world space can be understood as a three-dimensional space used to represent the three-dimensional space coordinates of an object.

[0077] In one example, the user's operation on the first application can be understood as the user's operation on the icon of the first application, or can be understood as the user's operation on the user interface of the first application. When implementing the specific embodiment, it needs to be determined according to the specific application scenario. Among them, the operation can be understood as a click operation, a press operation, a sliding operation, etc. The embodiments of this application are not specifically limited, and when implementing them specifically, they can be selected in combination with specific scenarios.

[0078] Exemplarily, when the user clicks the icon of the first application, the electronic device starts the first application. The process from the first application starting to the user interface display of the first application is the process of the electronic device drawing the user interface, which is as follows:

[0079] S501. In response to the operation, the electronic device obtains interface information of the first application, where the interface information may include light source information and information of the first object in the world space.

[0080] The first object can be understood as a pre-set object model, and the object model is used to represent a specified type of object. Exemplarily, the specified type of object can be milk, jade, marble or skin, and so on.

[0081] The information of the first object may include material properties, and the material properties may include translucent materials and materials with scattering functions. That is, the first object may be an object of translucent material. Alternatively, the first object may be an object that can refract light internally. The information of the first object may also include position information of each point on the surface of the first object, and the position information may be understood as position information in world space.

[0082] The light source can be understood as a light source in the scene. The information of the light source (referred to as light source information) may include light intensity, direction of photon beams, number of photon beams, and the like.

[0083] Of course, the electronic device obtaining the interface information of the first application in S501 is not limited to the triggering of S500, and the electronic device may also obtain the interface information of the first application at a preset time interval. Of course, the electronic device may also be triggered by at least two methods such as user operation and preset time interval, which is not specifically limited in the embodiments of the present application.

[0084] S502: The electronic device obtains a photon map and a shadow map according to the light source information and the information of the first object. The photon map includes the position information, intensity information and direction information of the light after refraction on the surface of the object at each point on the surface of the object.

[0085] The photon map is used to represent a texture map for storing the starting position, direction and intensity of a photon beam. The starting position of a photon beam may refer to the position of an initial photon (or initial point or starting point) in the photon beam.

[0086] The shadow map is used to represent shadow information of the first object.

[0087] In a specific implementation, the electronic device stores the position information, intensity information and direction information of the light after refraction on the surface of the first object at each point on the surface of the first object in a two-dimensional texture according to the light source information in the world space, so as to obtain a photon map and a shadow map. The intensity information here can be determined according to the world space position of the point on the surface of the object, the single scattering rate, the radiance of the incident light, the incident direction, the normal, the Fresnel transmission term, the refractive coefficient and other information.

[0088] In another specific implementation, the electronic device stores the position information, intensity information and direction information of the light after refraction on the surface of each point of the first object in a two-dimensional texture according to the light source information in the world space to obtain a photon map. Afterwards, the electronic device obtains a shadow map according to the light source information in the world space to calculate the shadow effect in the world space, and performs rendering calculations of the first object in the screen space.

[0089] In a specific implementation, since a photon beam in the world space is usually composed of 3-5 photon samples on the photon beam. Each sample point has its corresponding position and intensity. Storing all photons requires a large amount of memory space. According to the law that the photons on a photon beam are all located on the same ray and the photon intensity decays exponentially. Therefore, in the embodiment of the present application, only the position information and direction information of the initial point of each photon beam are stored, and the positions of other photons in the photon beam except the initial point can be adjusted by dynamically setting the offset t i To calculate, the expression can be:

[0090]

[0091] Among them, P b is the world space position of the stored object surface point, that is, the initial point of the photon beam b. b is the direction of the stored photon beam b. The offset t i The decision is made by exponential sampling. i is a random number between (0,1), σ t is the extinction coefficient.

[0092] Similarly, since the photon intensity on the same photon beam decreases proportionally in the direction of the photon beam, it is only necessary to store the initial intensity information of the object surface (the initial intensity information can be understood as the intensity information of the object surface when the photon intensity in the photon beam is the strongest). Combined with the light source function in the photon beam diffusion (PBD) model, the expression of the intensity information stored in the photon map in the embodiment of the present application can be:

[0093] I(P b ,ω)=α(P b )L(P b ,ω i )(n·ω)F t (ω,η)

[0094] Among them, P b is the world space position of the stored object surface point, α is the single scattering rate of the surface point of the first object, L is the radiance of the incident light, ω is the incident direction of the photon beam irradiating the object surface point, n is the normal of the object surface point, and F t is the Fresnel transmission term, η is the refractive index of the surface of the first object. The incident direction may refer to the direction of the incident light at a point on the surface of the object, and the direction of the photon beam is the direction of the light.

[0095] Therefore, based on the information stored in the photon map, the position information and intensity information of all photons on the photon beam can be reconstructed in sequence according to the above formula. It can be seen that the use of photon maps in the embodiments of the present application significantly reduces the storage space required for photon beam information. The photon map is two-dimensional texture information, and the information format stored on the GPU side is a texture format. In this way, the adaptability and computability of the photon map on the GPU side are greatly enhanced, effectively improving resource utilization and real-time rendering rate.

[0096] S503: The electronic device obtains normal and position information of each shading point on the first object in the screen space.

[0097] The screen space can be understood as the two-dimensional space of a computer screen.

[0098] The shading point can be understood as the color value of the point that needs to be calculated after the photon beam irradiates the surface point of the first object. That is, in the calculation process, the point is the shading point.

[0099] S504. The electronic device obtains the position information, direction and light intensity of each photon beam corresponding to each shading point according to the normal and position information of each shading point and the photon map.

[0100] The shading points on the surface of the first object may include a first shading point and a second shading point. In a specific implementable manner, the electronic device may project the first shading point of the position and normal to a photon map based on the normal and position information of the first shading point, and obtain the position information, direction, and light intensity of the first photon beam corresponding to the first shading point. Similarly, the electronic device may obtain the position information, direction, and light intensity of the second photon beam corresponding to the second shading point based on the normal and position information of the second shading point, and the photon map. By analogy, the electronic device projects each shading point into the photon map, and may obtain the position information (such as starting point information), direction, and intensity information of the photon beam corresponding to each shading point.

[0101] The first photon beam corresponding to the first colored point can be understood as the photon beam irradiating the first colored point.

[0102] S505: The electronic device determines the color value of each shading point according to the position information, direction and light intensity of each photon beam to obtain a subsurface scattering result of the first object.

[0103] In a specific implementation, Figure 5-2 As shown, S505 can be specifically implemented as follows:

[0104] S5051. The electronic device calculates a first color value of a first shading point of a first object by a photon beam in screen space according to a PBD model. The color value can be understood as an RGB value, where R represents Red, G represents Green, and B represents Blue.

[0105] The PBD model is a BSSRDF model derived by physics, whose parameters are related to both the scattering distance and the incident direction, and has better accuracy than the SSSS model and the canonical profile model. It evaluates the subsurface scattering results by distributing a beam inside the object, where a number of photons are assigned to the beam. Among them, the SSSS model is a BSSRDF model obtained by fitting, whose parameters are only related to the scattering distance, and has better accuracy. Among them, the canonical profile model is a BSSRDF model obtained by fitting, whose parameters are only related to the scattering distance, and has better accuracy.

[0106] In a specific implementation, the electronic device may project the first shading point of the position and normal to the photon map according to the normal and position information of the first shading point, and obtain the position information, direction and light intensity of the first photon beam corresponding to the first shading point. Afterwards, the electronic device calculates the first color value of the first shading point of the first object by the first photon beam in the screen space according to the PBD model.

[0107] S5052. The electronic device determines the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam.

[0108] Since the PBD model requires many parameters, the electronic device can reversely deduce the parameters of the PBD model according to the first photon beam to obtain the following parameters: the distance d from the real light source (referred to as the real source) to the shading point r , the distance d from the virtual light source (referred to as virtual source) to the shading point v , the depth z of the real source r , the depth z of the virtual source v The real light source can be understood as each photon in the first photon beam. The virtual light source can be understood as each photon in the first photon beam shifted, that is, each photon in the theoretical first photon beam.

[0109] Specifically, the electronic device determines the first color value of the first shading point according to the position information, direction, and light intensity of the first photon beam. The electronic device determines the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam. For example, Figure 6 As shown, the electronic device regards each photon in the first photon beam as a real source and the tangent plane of the first shading point on the surface of the first object as a ground reference. Then, the distance between the position of each photon in the first photon beam and the position of the first shading point can be regarded as d r , and this distance d r Decompose along the normal direction and the tangent plane direction at the first shading point, then d r The decomposition in the normal direction can be used as z r The depth z of the virtual source v Available through z r It can be deduced that z v =z r +2AD. A and D are both normalization factors, and AD represents the multiplication of A and D. The electronic device shifts the position of each photon in the first photon beam by z along the normal direction of the color point. r +4AD, the position of the virtual source can be obtained, and the distance d from the virtual source to the shading point can be calculated based on the position of the virtual source v In this way, the electronic device can determine the parameters of the PBD model.

[0110] S5053: After the electronic device determines the parameters of the PBD model, the electronic device obtains, according to the PBD model, a second color value of a second shading point irradiated by a second photon beam other than the first photon beam. For example, the expression may be:

[0111]

[0112] Among them, I(Pb ,ω) represents the intensity information of the second shading point on the surface of the object. b is the world space position of the second shading point on the surface of the object. ω is the incident direction of the photon beam on the second shading point on the surface of the object. ri ,d vi ,z ri ,z vi ) is the model calculation formula in the PBD model, which is used to calculate a photon P on the second photon beam. i The color value of the corresponding second shading point. ri Indicates the distance from the real source to the second shading point. d vi Represents the distance from the virtual source to the second shading point. ri Indicates the depth of the true source. vi Indicates the depth of the virtual source. N indicates the number of photons in the second photon beam. The color value of the second shading point by the photon can be understood as the color value of the second shading point under the irradiation of the photon.

[0113] Similarly, the electronic device obtains the third color value of the third coloring point under the irradiation of the third photon beam other than the first photon beam according to the PBD model. The specific calculation adopts the expression of B above, and the embodiment of the present application will not be repeated.

[0114] In an embodiment of the present application, by adopting the PBD model, the directional information of light after refraction on the surface of the object is taken into account in the photon map, that is, the refraction direction of light at the surface point of the object is taken into account, which significantly improves the accuracy of the results and makes both backlight transmission and front scattering more accurately drawn.

[0115] Due to the influence from world space to screen space, that is, the influence from three-dimensional space to two-dimensional space, directly using the PBD model for calculation will cause a large error. The factors that form this error are various and are related to the position of the photon, the extinction coefficient, and the single scattering rate. In order to eliminate or reduce the influence, in some embodiments, the electronic device uses at least one of the three correction factors to eliminate the influence. Specifically, the three correction factors may include: near-surface correction factor, extinction coefficient correction factor, and single scattering rate correction factor.

[0116] Exemplarily, the near-surface correction factor is used to correct the overestimation of near-surface photons. The overestimation of near-surface photons can be understood as the value calculated by the PBD model being too large. In other words, after being corrected by the near-surface correction factor, the value calculated by the PBD model is not too large. The expression of the near-surface correction factor is as follows:

[0117]

[0118] Among them, σ tis the extinction coefficient of the semi-transparent material of the first object. r Indicates the distance from the real source to the shading point.

[0119] In this way, the electronic device can eliminate the model error caused by the photon position based on the above B and near-surface correction factor.

[0120] Exemplarily, the extinction coefficient correction factor is used to correct the error caused by the change of the extinction coefficient. The expression of the extinction coefficient correction factor is as follows:

[0121] κ e =2.2pow(σ t ,-1.3)+0.02

[0122] Among them, σ t is the extinction coefficient of the semi-transparent material of the first object. Pow() represents the power function.

[0123] In this way, the electronic device can eliminate the model error caused by the change of the extinction coefficient based on the above B and the extinction coefficient correction factor.

[0124] Exemplarily, the single scattering rate correction factor is used to correct the error caused by the change of the single scattering rate. The expression of the single scattering rate correction factor is as follows:

[0125] κ α =0.34pow(α,20)+0.64

[0126] Wherein, α is the single scattering rate of the shading point on the surface of the first object.

[0127] In this way, the electronic device can be corrected according to the above B and the single scattering rate, eliminating the model error caused by the change of the single scattering rate.

[0128] In a specific implementation, the above B is multiplied by a near-surface correction factor, an extinction coefficient correction factor, and a single scattering rate correction factor to eliminate the influence.

[0129] The above method first calculates the first color value of the first shading point through the PBD model, and then reversely infers the parameters of the PBD model based on the position information, direction, light intensity, and first color value of the first photon beam. After obtaining the parameters, the final color value of the first shading point is accurately calculated. Similarly, the final color value of each shading point is obtained.

[0130] S5054: The electronic device obtains a subsurface scattering result of the first object according to the color values ​​of the plurality of shading points of the first object.

[0131] In a specific implementation, the electronic device can obtain the first coordinate corresponding to the first shading point on the photon map by projecting the first shading point onto the photon map. The electronic device obtains a preset area with the first coordinate as the center, and the preset area can be an area of ​​any shape, such as a square area. The electronic device obtains the color value of the first shading point for all photon beams within the preset area. The electronic device can obtain the weight of each photon beam for the color value of the first shading point based on the distance between the surface point of the first object corresponding to each photon beam and the first shading point, and the normal of the first shading point.

[0132] The specific expression can be:

[0133] w total =w d w n w b ,

[0134] w d =exp(-λ d ||P b -P o ||),

[0135] w n =exp(λ n (0.5ω b ·n-0.5)),

[0136] w b =exp(λ b (0.5ω b ·(P o -P b )-0.5))

[0137] Among them, w d is the weight in the distance dimension. n is the weight in the direction dimension. b is the weight in the beam dimension. b The world space position of the second point on the object surface to be stored. o is the world space position of the first point on the object surface stored. n is the normal of the second shading point. Exp() represents the index function. λ d ,λ n ,λ b You can define your own value. · Indicates the multiplication operator.

[0138] For example, in the embodiment of the present application, d ,λ n ,λ b It can be defined as 0.1, 0.01, and 0.8 respectively.

[0139] After the electronic device obtains the weight of the color value of the first shading point for each photon beam according to the above expression, the electronic device obtains the color value of the first shading point for each photon beam according to the weight and the color value of the corresponding shading point for each photon beam. The electronic device obtains the final color value of the first shading point according to the color value of the first shading point for each photon beam and the first color value. For example, according to the PBD model, the second color value and its weight of the second shading point for the second photon beam in the screen space are obtained; according to the PBD model, the third color value and its weight of the third shading point for the third photon beam in the screen space are obtained; according to the first color value, the second color value and its weight, and the third color value and its weight, the final color value of the first shading point is determined.

[0140] Similarly, the electronic device obtains the final color value of each shading point. That is, after filtering the texture, the electronic device can obtain the complete subsurface scattering result of the first object. It can be seen that in the embodiment of the present application, the complex splats construction is avoided by texture filtering, which significantly improves the calculation rate of semi-transparent material rendering.

[0141] S506: The electronic device obtains a diffuse reflection result and a highlight result of the first object.

[0142] In a specific implementable manner, the electronic device uses the existing highlight reflection model and diffuse reflection model to respectively calculate the highlight effect and diffuse reflection effect of the first object to obtain the diffuse reflection result and the highlight result of the first object.

[0143] S507: The electronic device draws an image of the first object according to the subsurface scattering result, the diffuse reflection result, and the highlight result.

[0144] In a specific achievable manner, in order to flexibly adjust the translucent effect of the material of the first object, the electronic device may combine the subsurface scattering result with the diffuse reflection result according to the linear relationship between the subsurface scattering result and the diffuse reflection result of the first object, and obtain the final color value of each shading point of the first object according to the mixed result and the highlight result. The electronic device draws the first object according to the color value.

[0145] In this way, the embodiment of the present application allows the use of a mixing factor, which can be understood as a mixing ratio value, to mix the subsurface scattering result with the diffuse reflection result to adjust the blurriness of the surface details of the object. At the same time, in some cases, the sampling of the object boundary in the photon map sometimes causes artifacts. The embodiment of the present application can solve the artifact problem through screen space (such as 7×7 screen space) Gaussian filtering. Finally, by adding the mixed result of the subsurface scattering result and the diffuse reflection result to the highlight result, the image of the first object drawn by the electronic device can be made more realistic and more accurate.

[0146] In practical applications, the present application provides an image rendering method that can be applied to the field of realistic semi-transparent object rendering in computer games or three-dimensional rendering platforms. For example, Figure 7 The present application provides a flow chart of an application scenario of an image drawing method. Compared with the original image drawing process, Figure 7 Before calculating the shadow map, the electronic device needs to calculate the photon map. The electronic device obtains the color value of each shading point on the surface of the translucent object based on the normal and position information of each shading point of the translucent object and the photon map. The electronic device completes the high-precision rendering of the translucent object based on the color value of each shading point, thereby drawing the image of the translucent object. Finally, the image drawn by the electronic device is presented Figure 8 The display effect shown.

[0147] However, on the one hand, its application direction should not be limited to games. For many fields involving the visualization of real translucent objects, such as furniture virtual visualization design, industrial real-time simulation and other application directions, medical virtual human simulation and visualization, this algorithm can be used for high-realistic presentation. On the other hand, since the main body of the technical solution of this application is the algorithm code, it should not be limited to a fixed computer platform, that is, it can be allowed to run on servers, various host platforms, mobile platforms, etc. However, it should be noted that for performance bottlenecks on different platforms, it is necessary to flexibly adjust parameters to ensure the calculation rate of this solution.

[0148] The specific implementation method of the embodiments of the present application is detailed in the above-mentioned related content, and the embodiments of the present application will not be repeated here.

[0149] The various solutions in the above embodiments of the present application can be combined without contradiction.

[0150] The present application also provides an electronic device for implementing any of the above methods. For example, an electronic device is provided that includes a unit (or means) for implementing each step performed by the electronic device in the above method S501-S507. Fig. 9 , which is a schematic diagram of an electronic device provided in an embodiment of the present application, the electronic device 900 may include: the electronic device 900 may include: an acquisition module 901, a determination module 902 and a drawing module 903; wherein,

[0151] The acquisition module 901 is used to acquire the light source information and the first object information in the world space; the first object information includes material properties, and the material properties include translucent materials and materials with scattering functions; the first object information also includes the position information of each point on the surface of the first object. Exemplarily, the acquisition module 901 can execute the above steps S500-S501. The acquisition module 901 can be Figure 3The processor 110 shown in .

[0152] The acquisition module 901 is used to acquire the diffuse reflection result, highlight result and photon map of the first object according to the light source information and the information of the first object, wherein the photon map includes the position information of each point on the surface of the first object, the intensity information and the direction information of the light after refraction on the surface of the first object. Exemplarily, the acquisition module 901 executes the above steps S502 and S506.

[0153] The acquisition module 901 is used to acquire the normal and position information of each shading point on the first object in the screen space. Exemplarily, the acquisition module 901 may execute the above step S503.

[0154] The determination module 902 is used to determine the color value of each shading point according to the normal and position information of each shading point and the photon map to obtain the subsurface scattering result of the first object. Exemplarily, the determination module 902 can execute the above steps S504-S505. The determination module 902 can be Figure 3 The processor 110 shown in .

[0155] The drawing module 903 is used to draw an image of the first object according to the subsurface scattering result, the diffuse reflection result and the highlight result. Exemplarily, the drawing module 903 may execute the above-mentioned step S507. The drawing module 903 may be Figure 3 The processor 110 shown in .

[0156] In one example, the determination module 902 is configured to:

[0157] According to the normal and position information of each shading point and the photon map, the position information, direction and light intensity of each photon beam corresponding to each shading point are obtained;

[0158] The color value of each shading point is determined according to the position information, direction and light intensity of each photon beam to obtain the subsurface scattering result of the first object.

[0159] In one example, the determination module 902 is configured to:

[0160] Calculate a first color value of a first shading point of a first photon beam in screen space according to a photon beam PBD model;

[0161] Determine the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam;

[0162] After determining the parameters of the PBD model, obtaining the color value of each shading point of the first object by each photon beam in the screen space according to the PBD model;

[0163] A subsurface scattering result of the first object is obtained according to the color values ​​of the plurality of shading points of the first object.

[0164] In one example, the parameters of the PBD model include: a distance from a real source to the first shading point, a distance from a virtual source to the first shading point, a depth of the real source, and a depth of the virtual source;

[0165] Among them, the real source is each photon in the first photon beam; the distance from the real source to the first shading point is the distance between each photon in the first photon beam and the first shading point; the depth of the real source is obtained based on the distance from the real source to the first shading point; the virtual source is each photon in the theoretical photon beam; the distance from the virtual source to the first shading point is determined based on the depth of the real source; the depth of the virtual source is determined based on the depth of the real source.

[0166] In one example, the acquisition module 901 is used to:

[0167] According to the PBD model, a second color value and a weight thereof of a second shading point of a second photon beam in screen space are obtained;

[0168] According to the PBD model, a third color value and a weight thereof of a third shading point of a third photon beam in screen space are obtained;

[0169] A final color value of the first shading point is determined according to the first color value, the second color value and its weight, and the third color value and its weight.

[0170] In an example, the electronic device may further include: an adjustment module 904, the adjustment module 904 is used to:

[0171] The parameters of the PBD model are adjusted according to the subsurface scattering results of the first object and the near-surface correction factor; the near-surface correction factor is used to correct the overestimation of near-surface photons.

[0172] In one example, the adjustment module 904 is further configured to:

[0173] The parameters of the PBD model are adjusted according to the subsurface scattering result of the first object and the extinction coefficient correction factor; the extinction coefficient correction factor is used to correct the error caused by the change of the extinction coefficient.

[0174] In one example, the adjustment module 904 is further configured to:

[0175] The parameters of the PBD model are adjusted according to the subsurface scattering result of the first object and the single scattering rate correction factor; the single scattering rate correction factor is used to correct the error caused by the change of the single scattering rate.

[0176] In an embodiment of the present application, an electronic device obtains light source information and information of a first object in world space. The electronic device obtains a photon map based on the light source information and the object information. The photon map includes position information, intensity information, and direction information of light after refraction on the surface of the object at each point on the surface of the object. The electronic device obtains the normal and position information of each shading point of the object in the screen space. The electronic device obtains the position information, direction, and light intensity of each photon beam of each shading point based on the normal and position information of each shading point and the photon map. The electronic device determines the subsurface scattering result of the object based on the position information, direction, and light intensity of each photon beam to draw an image of the object. The electronic device obtains the color value of each shading point of the object by obtaining the photon map and using the direction information of light after refraction on the surface of the object in the photon map, with high accuracy, so that the drawn image has a high sense of immersion and experience quality.

[0177] An embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on a computer, enable the computer to execute any of the above methods.

[0178] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any of the above methods.

[0179] An embodiment of the present application also provides a chip, which includes a processor and an interface circuit, the interface circuit is coupled to the processor, the processor is used to run a computer program or instruction to implement the above method, and the interface circuit is used to communicate with other modules outside the chip.

[0180] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different.

[0181] In the description of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0182] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0183] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, 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 devices or units, which can be electrical, mechanical or other forms.

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

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

[0186] 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 readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially 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, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) 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, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0187] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. An image drawing method, characterized in that: The method comprises: Acquire light source information and information of a first object in world space; the information of the first object includes material properties, and the material properties include translucent materials and materials with scattering functions; the information of the first object also includes position information of each point on the surface of the first object; According to the light source information and the information of the first object, a diffuse reflection result, a highlight result and a photon map of the first object are obtained, wherein the photon map includes position information of each point on the surface of the first object, intensity information and direction information of light after refraction on the surface of the first object; Obtaining normal and position information of each shading point on the first object in screen space; Determine the color value of each shading point according to the normal and position information of each shading point and the photon map to obtain a subsurface scattering result of the first object; An image of the first object is drawn according to the subsurface scattering result, the diffuse reflection result, and the highlight result.

2. The method according to claim 1, characterized in that Determining the color value of each shading point according to the normal and position information of each shading point and the photon map to obtain the subsurface scattering result of the first object includes: According to the normal and position information of each shading point and the photon map, the position information, direction and light intensity of each photon beam corresponding to each shading point are obtained; The color value of each shading point is determined according to the position information, direction and light intensity of each photon beam to obtain a subsurface scattering result of the first object.

3. The method according to claim 2, characterized in that Determining the color value of each shading point according to the position information, direction and light intensity of each photon beam to obtain the subsurface scattering result of the first object includes: Calculate, according to the photon beam PBD model, a first color value of the first shading point for the first photon beam in the screen space; Determine the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam; After determining the parameters of the PBD model, obtaining, according to the PBD model, the color value of each shading point of the first object by each photon beam in the screen space; A subsurface scattering result of the first object is obtained according to color values ​​of a plurality of shading points of the first object.

4. The method according to claim 3, characterized in that The parameters of the PBD model include: a distance from a real source to the first shading point, a distance from a virtual source to the first shading point, a depth of the real source, and a depth of the virtual source; Among them, the real source is each photon in the first photon beam; the distance from the real source to the first shading point is the distance between each photon in the first photon beam and the first shading point; the depth of the real source is obtained based on the distance from the real source to the first shading point; the virtual source is each photon in the theoretical photon beam; the distance from the virtual source to the first shading point is determined based on the depth of the real source; the depth of the virtual source is determined based on the depth of the real source.

5. The method according to claim 3, characterized in that: According to the PBD model, obtaining color values ​​of each shading point of the first object by each photon beam in the screen space includes: According to the PBD model, obtaining a second color value and a weight thereof of a second shading point of a second photon beam in screen space; According to the PBD model, obtaining a third color value and a weight thereof of a third shading point of a third photon beam in screen space; A final color value of the first shading point is determined according to the first color value, the second color value and its weight, and the third color value and its weight.

6. The method according to any one of claims 1 to 5, characterized in that Also includes: Adjusting parameters of the PBD model according to a subsurface scattering result and a near-surface correction factor of the first object; The near-surface correction factor is used to correct for the overestimation of near-surface photons.

7. The method according to any one of claims 1 to 6, characterized in that Also includes: adjusting the parameters of the PBD model according to the subsurface scattering result and the extinction coefficient correction factor of the first object; The extinction coefficient correction factor is used to correct the error caused by the change of the extinction coefficient.

8. The method according to any one of claims 1 to 7, characterized in that Also includes: The parameters of the PBD model are adjusted according to the subsurface scattering result of the first object and a single scattering rate correction factor; the single scattering rate correction factor is used to correct the error caused by the change of the single scattering rate.

9. An electronic device, characterized in that: The electronic device comprises: an acquisition module, a determination module and a drawing module; wherein, The acquisition module is used to acquire light source information and information of the first object in the world space; the information of the first object includes material properties, and the material properties include translucent materials and materials with scattering functions; the information of the first object also includes position information of each point on the surface of the first object; The acquisition module is used to acquire the diffuse reflection result, highlight result and photon map of the first object according to the light source information and the information of the first object, wherein the photon map includes the position information of each point on the surface of the first object, the intensity information and the direction information of the light after refraction on the surface of the first object; The acquisition module is used to acquire normal and position information of each shading point on the first object in the screen space; The determination module is used to determine the color value of each shading point according to the normal and position information of each shading point and the photon map, so as to obtain the subsurface scattering result of the first object; The drawing module is used to draw the image of the first object according to the subsurface scattering result, the diffuse reflection result and the highlight result.

10. The electronic device according to claim 9, characterized in that: The determination module is used for: According to the normal and position information of each shading point and the photon map, the position information, direction and light intensity of each photon beam corresponding to each shading point are obtained; The color value of each shading point is determined according to the position information, direction and light intensity of each photon beam to obtain a subsurface scattering result of the first object.

11. The electronic device according to claim 10, characterized in that: The determination module is used for: Calculate, according to the photon beam PBD model, a first color value of the first shading point for the first photon beam in the screen space; Determine the parameters of the PBD model according to the position information, direction, light intensity, and first color value of the first photon beam; After determining the parameters of the PBD model, obtaining, according to the PBD model, the color value of each shading point of the first object by each photon beam in the screen space; A subsurface scattering result of the first object is obtained according to color values ​​of a plurality of shading points of the first object.

12. The electronic device according to claim 11, characterized in that: The parameters of the PBD model include: a distance from a real source to the first shading point, a distance from a virtual source to the first shading point, a depth of the real source, and a depth of the virtual source; Among them, the real source is each photon in the first photon beam; the distance from the real source to the first shading point is the distance between each photon in the first photon beam and the first shading point; the depth of the real source is obtained based on the distance from the real source to the first shading point; the virtual source is each photon in the theoretical photon beam; the distance from the virtual source to the first shading point is determined based on the depth of the real source; the depth of the virtual source is determined based on the depth of the real source.

13. The electronic device according to claim 12, characterized in that: The acquisition module is used for: According to the PBD model, obtaining a second color value and a weight thereof of a second shading point of a second photon beam in screen space; According to the PBD model, obtaining a third color value and a weight thereof of a third shading point of a third photon beam in screen space; A final color value of the first shading point is determined according to the first color value, the second color value and its weight, and the third color value and its weight.

14. The electronic device according to any one of claims 9 to 13, characterized in that: Also includes: An adjustment module, wherein the adjustment module is used to: The parameters of the PBD model are adjusted according to the subsurface scattering result of the first object and a near-surface correction factor; the near-surface correction factor is used to correct the overestimation of near-surface photons.

15. The electronic device according to any one of claims 9 to 14, characterized in that: The adjustment module is also used for: The parameters of the PBD model are adjusted according to the subsurface scattering result of the first object and the extinction coefficient correction factor; the extinction coefficient correction factor is used to correct the error caused by the change of the extinction coefficient.

16. The electronic device according to any one of claims 9 to 15, characterized in that: The adjustment module is also used for: The parameters of the PBD model are adjusted according to the subsurface scattering result of the first object and a single scattering rate correction factor; the single scattering rate correction factor is used to correct the error caused by the change of the single scattering rate.

17. An electronic device, characterized in that: The electronic device comprises: one or more processors; and a memory, wherein codes are stored in the memory; when the codes are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 8.

19. A chip system, characterized in that: The method comprises one or more processors. When the one or more processors execute instructions, the one or more processors perform the method according to any one of claims 1 to 8.