Graph rendering method and electronic equipment

By using the identification information of multiple primary pixels to average irradiance, the irradiance of secondary pixels is generated, the problem of improving rendering efficiency in computer rendering is solved, low-resolution approximation of high-resolution maps is achieved, and the rendering effect and efficiency are improved.

CN119863557APending Publication Date: 2025-04-22HUAWEI TECH CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311375604.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-20
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

During computer rendering, how to improve rendering efficiency without losing rendering effects, especially when dealing with large amounts of sample points and attributes.

Method used

In the process of mipmap construction of the original resolution image, the identification information of multiple primary pixels is used to determine the object to be rendered to which different pixels belong, and the irradiance average of the multiple primary pixels belonging to the same object to be rendered is performed to generate the irradiance of the secondary pixels.

Benefits of technology

This method helps to generate low-resolution maps that are closer to high-resolution maps, improves the display effect of the rendered target graphics, and improves rendering efficiency to a certain extent.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119863557A_ABST
    Figure CN119863557A_ABST
Patent Text Reader

Abstract

The invention provides a graph rendering method and electronic equipment, and the method comprises the steps: determining to-be-rendered objects to which different first-level pixels belong through employing the identification information of a plurality of first-level pixels in a process of carrying out the mipmap construction of an original resolution graph; and the irradiance of the first-level pixels belonging to the same to-be-rendered object is only averaged so as to determine the irradiance of the second-level pixels. According to the rendering method and the electronic equipment provided by the invention, the high-resolution irradiance map can be utilized to generate the low-resolution irradiance map closer to the high-resolution irradiance map, so that the rendering efficiency of the target graph is improved, and the display effect of the rendered target graph is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer software, and more specifically, to a graphics rendering method and an electronic device. Background Art

[0002] In the computer rendering process, by selecting sample points on the surface of the object or graphic to be rendered, and using the properties of the sample points for light reflection, refraction and transmission, the color, shadow and other display effects of the object or graphic surface to be rendered can be approximately determined. The more sample points are used, the richer the properties of the sample points are considered, and the more realistic the rendered graphics and images are, but more sample points and more properties mean a larger amount of data and lower rendering efficiency.

[0003] How to improve rendering efficiency without losing rendering effect is a question worth considering. Summary of the invention

[0004] The present application provides a graphics rendering method. In the process of constructing mipmap for an original resolution image, identification information of multiple primary pixels is used to determine the objects to be rendered to which different pixels belong, and only the irradiance of multiple primary pixels belonging to the same object to be rendered is averaged to generate the irradiance of the secondary pixels. The rendering method is conducive to determining a low-resolution map that is closer to a high-resolution map, and is conducive to improving the display effect of the rendered target graphics.

[0005] In a first aspect, a graphics rendering method is provided, which is applied to an electronic device, the method comprising: determining a secondary map based on a primary map, the irradiance of each secondary pixel in the secondary map being determined based on identification information and irradiance of M primary pixels in the primary map, the M primary pixels and the corresponding secondary pixels indicating the same area of ​​a target graphic, the identification information of the primary pixel being used to indicate an object to be rendered to which the primary pixel belongs, and M being an integer greater than or equal to 2; determining multiple sample points from multiple primary pixels and multiple secondary pixels; and rendering the target graphic based on the irradiance of the multiple sample points.

[0006] In some scenarios, the identification information may also be called a tag, which can be used to identify the object to be rendered. In other words, different objects to be rendered have different identification information. The identification information may be one or more of numbers, characters, and strings.

[0007] In some examples, the method further includes: determining a tertiary map according to the secondary map, the irradiance of each tertiary pixel in the tertiary map is determined according to the identification information and irradiance of M secondary pixels in the secondary map, the positions of the M secondary pixels in the secondary map are the same as the positions of the corresponding tertiary pixels in the tertiary map, the identification information of the secondary pixels is used to indicate the object to be rendered to which the secondary pixels belong, and M is an integer greater than or equal to 2. Determining a plurality of sample points from a plurality of primary pixels and a plurality of secondary pixels includes: determining a plurality of sample points from a plurality of primary pixels, a plurality of secondary second pixels, and a plurality of tertiary pixels.

[0008] The technical solution uses identification information to identify the objects to be rendered to which different pixels belong. In the subsequent rendering process, especially in the process of generating a low-resolution map using a high-resolution map, the identification information can be used to assist in determining the irradiance of the pixels in the low-resolution map, which is conducive to generating a low-resolution map that is more similar to the high-resolution map. When the number of sample points used for rendering remains unchanged, the technical solution can improve the display effect of the target graphics finally rendered to a certain extent. From another perspective, the implementation of the technical solution is conducive to improving the rendering efficiency of the target graphics.

[0009] In addition, the irradiance of the secondary pixels is determined after filtering the irradiance of multiple primary pixels, that is, irradiance maps of different resolutions are constructed. Subsequent sample points can be selected from these different irradiance maps, which is beneficial to reducing the amount of samples used to render the target graphics and improving the rendering efficiency of the target graphics.

[0010] In combination with the first aspect, in certain implementations of the first aspect, when there are at least two first-level pixels with the same identification information among the M first-level pixels, the irradiance of the secondary pixel is the average value of the irradiances of the first-level pixels with the same identification information; or, when there are not two first-level pixels with the same identification information among the M first-level pixels, the irradiance of the secondary pixel is the irradiance of the target pixel, and the target pixel is the first-level pixel with the highest priority among the M first-level pixels to which the object to be rendered belongs, and the priority of the object to be rendered is determined according to the identification information.

[0011] In different situations, in the process of determining the irradiance of the secondary pixel by the identification information and irradiance of the primary pixel, the identification information can be used to identify whether the objects to be rendered corresponding to different primary pixels are the same, or to determine the priority of the objects to be rendered corresponding to the primary pixels. The use of identification information helps to determine a more appropriate irradiance for the secondary pixel, and the irradiance information of the sample points subsequently determined from multiple secondary pixels is also more conducive to achieving efficient rendering of the target graphics. The implementation of this technical solution is conducive to improving the rendering quality and rendering efficiency of the target graphics.

[0012] In combination with the first aspect, in certain implementations of the first aspect, multiple sample points are determined from multiple primary pixels and multiple secondary pixels, including: determining a first sample point within a sampling area of ​​the primary map; determining a second sample point within a sampling area of ​​the secondary map; wherein the multiple sample points include the first sample point and the second sample point, and the sampling area of ​​the secondary map is set around the sampling area of ​​the primary map.

[0013] In some scenarios, the above technical solution can also be understood as: the first sample point among multiple sample points is determined from the primary sampling area of ​​the primary map composed of multiple primary pixels, and the second sample point among the multiple sample points is determined from the secondary sampling area of ​​the secondary map composed of multiple secondary pixels.

[0014] The sampling surround distribution pattern of the samples in the present technical solution, in which the sample points are distributed in a sampling area consisting of a central area and multiple annular areas on the periphery, complies with the rule of more precise sampling in adjacent areas and coarser sampling in distant areas. Compared with the fixed sampling method, the present technical solution can improve the accuracy of the rendering results to a certain extent, and is conducive to improving the flexibility of rendering sample selection.

[0015] In combination with the first aspect, in certain implementations of the first aspect, the range of the sampling area of ​​the primary map is determined according to the illumination direction, the normals at multiple primary pixels, and the scattering coefficient of the object to be rendered to which the primary pixels belong.

[0016] When determining the range of the sampling area, this technical solution comprehensively considers factors such as the lighting direction of the light source information in the scene to be rendered, the geometric information of the object to be rendered, the scattering coefficient corresponding to the material of the object to be rendered, etc., which is conducive to determining a more appropriate sampling range, selecting more appropriate sample points, improving the rendering effect of the target graphics, and improving the rendering efficiency of the target graphics.

[0017] In conjunction with the first aspect, in certain implementations of the first aspect, the range of the sampling area in the primary map is determined according to the following formula:

[0018] C1=R·exp(-ε d ·min(|n·ω|+0.5,1))·min(0.02σ t +0.5,1);

[0019] Where C1 is the range of the primary sampling area, R is the first preset value, ε d is the second preset value, n is the normal at the primary pixel, ω is the illumination direction, σ t is the extinction coefficient of the object to be rendered to which the primary pixel belongs.

[0020] The present technical solution specifically provides a calculation formula for calculating the range of the primary sampling area, which is conducive to improving the applicability of the rendering method provided by the present application in different application scenarios.

[0021] In combination with the first aspect, in certain implementations of the first aspect, the outer boundaries of the sampling area of ​​the primary map and the outer boundaries of the sampling area of ​​the secondary map are both enclosed in a square, and the side length of the sampling area of ​​the secondary map is twice the side length of the sampling area of ​​the primary map.

[0022] It should be noted here that the outer contours of the first sampling area and the second sampling area can both enclose a square area. The side length of the first sampling area should be understood as the side length of the square area enclosed by the outer contour of the first sampling area, and the side length of the second sampling area should be understood as the side length of the area enclosed by the outer contour of the second sampling area.

[0023] In the technical solution, the range of the sampling area of ​​the secondary map can be directly determined according to the range of the sampling area of ​​the primary map, which is conducive to reducing the complexity of the rendering method provided by the present application and improving the rendering efficiency of the target graphics. In addition, setting the side length of the sampling area of ​​the secondary map to twice the side length of the sampling area of ​​the primary map is more compatible with the hardware architecture of the graphics processing unit. From this perspective, the technical solution is also conducive to improving the rendering efficiency of the target graphics.

[0024] In combination with the first aspect, in certain implementations of the first aspect, determining a first sample point within a sampling area of ​​a first-level map includes: determining the first sample point within the sampling area of ​​the first-level map according to a first-level sampling step, wherein the first-level sampling step is determined according to the size of an area covered by the light source space and the size of a bounding box of an object to be rendered.

[0025] In some scenarios, the sampling step size can also be called the sample spacing.

[0026] When determining the sampling step, this technical solution comprehensively considers the size of the object to be rendered, the size of the area covered by the light source space in the light source information, the first-level map resolution and other information, and can determine the sampling step based on this information. The implementation of this solution is conducive to determining a more appropriate sampling step, that is, it is conducive to determining a more appropriate sample distribution, it is conducive to selecting more appropriate sample points, it is conducive to improving the rendering effect of the target graphics, and it is conducive to improving the rendering efficiency of the target graphics.

[0027] In combination with the first aspect, in certain implementations of the first aspect, the first-level sampling step size is greater than or equal to the minimum pixel side length in the first-level map, and the resolution of the first-level map is greater than or equal to a preset threshold.

[0028] The technical solution provides restrictive conditions in the sampling process, wherein limiting the sampling step to be no less than the side length of the smallest pixel in the primary map can make the sample points obtained by sampling contain an integer number of map pixels, and limiting the resolution of the primary map to be greater than or equal to a preset threshold, which is conducive to fully refining the surface of the object to be rendered, so that the area of ​​the surface of the object to be rendered corresponding to each pixel is small enough, thereby facilitating improving the rendering efficiency of the target graphics.

[0029] In combination with the first aspect, in certain implementations of the first aspect, determining a second sample point within a sampling area of ​​the secondary map includes: determining the second sample point within the sampling area within the secondary map according to a secondary sampling step size, wherein the secondary sampling step size is twice the primary sampling step size.

[0030] In the technical solution, the sampling step of the secondary map can be directly determined according to the sampling step of the primary map, which is conducive to reducing the complexity of the rendering method provided by the present application and improving the rendering efficiency of the target graphics. In addition, setting the secondary sampling step to twice the primary sampling step is more compatible with the hardware architecture of the graphics processing unit, which is conducive to improving the rendering efficiency of the target graphics.

[0031] In combination with the first aspect, in some implementations of the first aspect, M=4.

[0032] In some examples, when the value of M is greater than 4, the larger the value of M, the worse the display effect of the target graphics rendered according to the sample points obtained by the primary pixels, the secondary pixels, etc. When the value of M is less than 4, the calculation efficiency provided by the present application is low.

[0033] In a possible implementation, the value of M may be determined according to the size of the primary pixels and the distribution of the primary pixels in the region.

[0034] The irradiance of one secondary pixel is determined by using the irradiance and identification information of four primary pixels. This solution is conducive to generating irradiance maps with lower resolution. In addition, the use of four primary pixels for processing is more compatible with the hardware architecture of the graphics processing unit, which is conducive to improving the rendering efficiency of the target graphics.

[0035] In combination with the first aspect, in certain implementations of the first aspect, the identification information of each secondary pixel in the secondary map is determined based on the identification information of M primary pixels in the primary map; when there are at least two primary pixels with the same identification information among the M primary pixels, the identification information of the secondary pixel is the identification information of the primary pixels with the same identification information; or, when there are no two primary pixels with the same identification information among the M primary pixels, the identification information of the secondary pixel is the identification information of the target pixel, the target pixel is the primary pixel with the highest priority among the M primary pixels for the object to be rendered, and the priority of the object to be rendered is determined based on the identification information.

[0036] The identification information of the secondary pixel can also be determined based on the identification information of multiple primary pixels, so that the irradiance of the tertiary pixel can also be determined using the irradiance and identification information of multiple secondary pixels. The implementation of this technical solution is conducive to constructing multiple irradiance maps of different resolutions, which is conducive to reducing the total number of sample points required for rendering the target graphics, and is conducive to improving the rendering efficiency of the target graphics.

[0037] In combination with the first aspect, in certain implementations of the first aspect, the identification information of the primary pixel is a preset value, and when the number of at least one object to be rendered is multiple, the identification information corresponding to different objects to be rendered in the at least one object to be rendered is different.

[0038] In combination with the first aspect, in some implementations of the first aspect, at least one object to be rendered is a semi-transparent object.

[0039] In a possible implementation, the rendering process of the semi-transparent object may be inserted into the rendering process of the forward opaque object in the target graphic, or the rendering process of the semi-transparent object may be inserted into the post-processing process of the target graphic.

[0040] The specific instructions and beneficial effects of the following technical solutions can refer to the relevant description in the first aspect, and for the sake of brevity, they are not repeated below.

[0041] In a second aspect, a graphics rendering device is provided, which includes a processing module, which is used to: determine a secondary map based on the primary map, the irradiance of each secondary pixel in the secondary map is determined based on the identification information and irradiance of M primary pixels in the primary map, the M primary pixels and the corresponding secondary pixels indicate the same area of ​​the target graphic, the identification information of the primary pixel is used to indicate the object to be rendered to which the primary pixel belongs, and M is an integer greater than or equal to 2; determine multiple sample points from multiple primary pixels and multiple secondary pixels; and render the target graphic according to the irradiance of the multiple sample points.

[0042] In combination with the second aspect, in certain implementations of the second aspect, when there are at least two primary pixels with the same identification information among the M primary pixels, the irradiance of the secondary pixel is the average value of the irradiances of the primary pixels with the same identification information; or, when there are not two primary pixels with the same identification information among the M primary pixels, the irradiance of the secondary pixel is equal to the irradiance of the target pixel, and the target pixel is the primary pixel with the highest priority among the M primary pixels for the object to be rendered, and the priority of the object to be rendered is determined according to the identification information.

[0043] In combination with the second aspect, in certain implementations of the second aspect, the processing module is specifically used to: determine a first sample point within a sampling area of ​​the primary map; determine a second sample point within a sampling area of ​​the secondary map; wherein the multiple sample points include a first sample point and a second sample point, and the sampling area of ​​the secondary map is set around the sampling area of ​​the primary map.

[0044] In combination with the second aspect, in certain implementations of the second aspect, the range of the sampling area of ​​the primary map is determined according to the illumination direction, the normals at multiple primary pixels, and the scattering coefficient of the object to be rendered to which the primary pixels belong.

[0045] In conjunction with the second aspect, in certain implementations of the second aspect, the range of the sampling area in the primary map is determined according to the following formula:

[0046] C1=R·exp(-ε d ·min(|n·ω|+0.5,1))·min(0.02σ t +0.5,1);

[0047] Where C1 is the range of the primary sampling area, R is the first preset value, ε d is the second preset value, n is the normal at the primary pixel, ω is the illumination direction, σ t is the extinction coefficient of the object to be rendered to which the primary pixel belongs.

[0048] In combination with the second aspect, in certain implementations of the second aspect, the outer boundaries of the sampling area of ​​the primary map and the outer boundaries of the sampling area of ​​the secondary map are both enclosed in a square, and the side length of the sampling area of ​​the secondary map is twice the side length of the sampling area of ​​the primary map.

[0049] In combination with the second aspect, in certain implementations of the second aspect, the processing module is specifically used to: determine the first sample point within the sampling area of ​​the first-level map according to the first-level sampling step, and the first-level sampling step is determined according to the size of the area covered by the light source space and the size of the bounding box of the object to be rendered.

[0050] In combination with the second aspect, in certain implementations of the second aspect, the first-level sampling step size is greater than or equal to the minimum pixel side length in the first-level map, and the resolution of the first-level map is greater than or equal to a preset threshold.

[0051] In combination with the second aspect, in some implementations of the second aspect, the processing module is specifically used to: determine the second sample point in the sampling area within the secondary map according to the secondary sampling step, and the secondary sampling step is twice the primary sampling step.

[0052] In combination with the second aspect, in some implementations of the second aspect, M=4.

[0053] In combination with the second aspect, in certain implementations of the second aspect, the identification information of each secondary pixel in the secondary map is determined based on the identification information of M primary pixels in the primary map, and when the M primary pixels include at least two primary pixels with the same identification information, the identification information of the secondary pixel is the identification information of the primary pixels with the same identification information; or, when there are not two primary pixels with the same identification information among the M primary pixels, the identification information of the secondary pixel is the identification information of the target pixel, and the target pixel is the primary pixel with the highest priority among the M primary pixels of the object to be rendered, and the priority of the object to be rendered is determined based on the identification information.

[0054] In combination with the second aspect, in certain implementations of the second aspect, the identification information of the primary pixel is a preset value, and when the number of at least one object to be rendered is multiple, the identification information corresponding to different objects to be rendered in the at least one object to be rendered is different.

[0055] In combination with the second aspect, in some implementations of the second aspect, at least one object to be rendered is a semi-transparent object.

[0056] In a third aspect, an electronic device is provided, which includes a processor and a memory, the memory is used to store program instructions, and the processor is used to: determine a secondary map based on the primary map, the irradiance of each secondary pixel in the secondary map is determined based on the identification information and irradiance of M primary pixels in the primary map, the M primary pixels and the corresponding secondary pixels indicate the same area of ​​the target graphic, the identification information of the primary pixel is used to indicate the object to be rendered to which the primary pixel belongs, and M is an integer greater than or equal to 2; determine multiple sample points from multiple primary pixels and multiple secondary pixels; and render the target graphic according to the irradiance of the multiple sample points.

[0057] In combination with the third aspect, in certain implementations of the third aspect, the processor is specifically used to: when there are at least two primary pixels with the same identification information among the M primary pixels, the irradiance of the secondary pixel is the average value of the irradiances of the primary pixels with the same identification information; or, when there are not two primary pixels with the same identification information among the M primary pixels, the irradiance of the secondary pixel is the irradiance of the target pixel, and the target pixel is the primary pixel with the highest priority among the M primary pixels for the object to be rendered, and the priority of the object to be rendered is determined according to the identification information.

[0058] In combination with the third aspect, in certain implementations of the third aspect, the processor is specifically used to: determine a first sample point within a sampling area of ​​the primary map; determine a second sample point within a sampling area of ​​the secondary map; wherein the multiple sample points include a first sample point and a second sample point, and the sampling area of ​​the secondary map is set around the sampling area of ​​the primary map.

[0059] In combination with the third aspect, in certain implementations of the third aspect, the range of the sampling area of ​​the primary map is determined according to the illumination direction, the normals at multiple primary pixels, and the scattering coefficient of the object to be rendered to which the primary pixels belong.

[0060] In conjunction with the third aspect, in certain implementations of the third aspect, the range of the sampling area in the primary map is determined according to the following formula:

[0061] C1=R·exp(-ε d ·min(|n·ω|+0.5,1))·min(0.02σ t +0.5,1);

[0062] Where C1 is the range of the primary sampling area, R is the first preset value, ε d is the second preset value, n is the normal at the primary pixel, ω is the illumination direction, σ t is the extinction coefficient of the object to be rendered to which the primary pixel belongs.

[0063] In combination with the third aspect, in certain implementations of the third aspect, the outer boundaries of the sampling area of ​​the primary map and the outer boundaries of the sampling area of ​​the secondary map are both enclosed in a square, and the side length of the sampling area of ​​the secondary map is twice the side length of the sampling area of ​​the primary map.

[0064] In combination with the third aspect, in certain implementations of the third aspect, the processor is specifically used to: determine the first sample point within the sampling area of ​​the first-level map according to the first-level sampling step, and the first-level sampling step is determined according to the size of the area covered by the light source space and the size of the bounding box of the object to be rendered.

[0065] In combination with the third aspect, in certain implementations of the third aspect, the first-level sampling step size is greater than or equal to the minimum pixel side length in the first-level map, and the resolution of the first-level map is greater than or equal to a preset threshold.

[0066] In combination with the third aspect, in certain implementations of the third aspect, the processor is specifically used to: determine a second sample point in a sampling area within the secondary map according to a secondary sampling step, and the secondary sampling step is twice the primary sampling step.

[0067] In combination with the third aspect, in some implementations of the third aspect, M=4.

[0068] In combination with the third aspect, in certain implementations of the third aspect, the identification information of each secondary pixel in the secondary map is determined based on the identification information of M primary pixels in the primary map; in a case where the M primary pixels include at least two primary pixels with the same identification information, the identification information of the secondary pixel is the identification information of the primary pixels with the same identification information; or, in a case where there are not two primary pixels with the same identification information among the M primary pixels, the identification information of the secondary pixel is the identification information of the target pixel, the target pixel is the primary pixel with the highest priority among the M primary pixels for the object to be rendered, and the priority of the object to be rendered is determined based on the identification information.

[0069] In combination with the third aspect, in certain implementations of the third aspect, the identification information of the primary pixel is a preset value, and when the number of at least one object to be rendered is multiple, the identification information corresponding to different objects to be rendered in the at least one object to be rendered is different.

[0070] In combination with the third aspect, in some implementations of the third aspect, at least one object to be rendered is a semi-transparent object.

[0071] According to a fourth aspect, a computer program product is provided. The computer program product comprises a computer program code. When the computer program code is run on a computer, the method in the first aspect and any possible implementation manner thereof is executed.

[0072] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the method in the first aspect and any possible implementation thereof is executed.

[0073] In a sixth aspect, a chip is provided, comprising a processor for reading instructions stored in a memory, wherein when the processor executes the instructions, the chip implements the method in the first aspect and any possible implementation thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1It is a schematic diagram of a rendering method provided in an embodiment of the present application.

[0075] Figure 2 It is a schematic diagram of another rendering method provided in an embodiment of the present application.

[0076] Figure 3 It is a schematic diagram of another rendering method provided in an embodiment of the present application.

[0077] Figure 4 It is a schematic diagram of another rendering method provided in an embodiment of the present application.

[0078] Figure 5 Schematic diagram of irradiance maps of different resolutions provided in an embodiment of the present application.

[0079] Figure 6 It is a schematic diagram of the sampling area provided in the embodiment of the present application.

[0080] Figure 7 It is a flowchart of a method for determining a sampling step size provided in an embodiment of the present application.

[0081] Figures 8 to 10 It is a schematic diagram of an applicable scenario of the rendering method provided in an embodiment of the present application.

[0082] Fig.11 It is a schematic diagram of the architecture of a computer program product provided in an embodiment of the present application.

[0083] Fig.12 It is a schematic diagram of a rendering device provided in an embodiment of the present application.

[0084] Fig.13 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0086] The terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one, two or more. The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0087] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0088] Before formally introducing the embodiments of the present application, some professional terms that may be used in the following content are first explained.

[0089] Subsurface scattering is used to describe the lighting phenomenon in which light is scattered when passing through a transparent / translucent surface. It refers to the process in which light enters an object from the surface, is scattered internally, and then is emitted through other vertices on the surface of the object.

[0090] Bidirectional scattering surface reflectance distribution function (BSSRDF): A computational model for evaluating subsurface scattering results on translucent objects.

[0091] Irradiance is an optical measurement for light, expressed as the integral of the radiance of light in a direction. In rendering, it is generally used to represent the interaction between light in a scene and the surface of an object.

[0092] Irradiance Samples,In many methods, the irradiance results calculated for the surface of an object are,stored in different ways. The irradiances of these stored surface points are,called irradiance samples.

[0093] Irradiance (sample) map, one storage method is to store three-dimensional irradiance samples on a two-dimensional texture map. The map that stores irradiance samples is called an irradiance map.

[0094] Sampling, in the calculation of subsurface scattering, it is generally not necessary to evaluate all irradiance samples, but to select several samples from them. This selection behavior is called sampling.

[0095] Sampling range and sampling step size. When sampling on a texture, a region will be selected on the texture first, which is the sampling range. In this range, the distance between samples (sample spacing) needs to be calculated, which is the sampling step size. The sample spacing can be used to evenly distribute samples within the sampling range.

[0096] Importance sampling is a sampling method that mainly determines the distribution position of samples by inverse calculation of a specific calculation formula.

[0097] Optical parameters and scattering coefficients are a series of parameters used to represent the optical properties of translucent materials. In the present invention, they mainly refer to the extinction coefficient.

[0098] Clustering, hierarchical construction, a way of organizing data samples, expressed as several levels. The original samples are stored in the lowest level, and in the higher level, fewer samples are used to approximate the samples in the lower level, and so on. The number of samples decreases as the level increases.

[0099] Mipmap, also known as map refinement, texture, texture detail level, etc., is a hierarchical construction method for two-dimensional textures. Generally, the original resolution map is processed by filtering to approximate the original resolution map with a lower resolution map.

[0100] Box filtering is a filtering method that averages the pixel information of four adjacent pixels.

[0101] Shadow map: A shadow rendering technique that determines whether a shadow should exist on the surface of an object by storing the depth of the object in the three-dimensional scene from the perspective of the light source.

[0102] Post-processing refers to a rendering method in which only the final screen space image is processed during the 3D scene rendering process.

[0103] Highlight / specular reflection: If the reflective surface is relatively smooth, when parallel incident light hits the reflective surface, it will still be reflected in parallel in one direction. This kind of reflection is called specular reflection.

[0104] Diffuse reflection is the phenomenon that light projected on a rough surface is reflected in all directions. When a parallel beam of incident light hits a rough surface, the surface will reflect the light in all directions, causing the reflected light to be reflected irregularly in different directions.

[0105] Rendering pipeline / rendering pipeline process: The rendering pipeline is also called the rendering pipeline, which is an independent parallel processing unit inside the display chip that processes graphics signals. Based on this, the rendering order is defined for the 3D scene to render different objects with different effects, which is called the rendering pipeline process.

[0106] Scriptable render pipeline (SRP): A rendering pipeline process with a customizable rendering order used in the Unity engine.

[0107] Translucent rendering technology is essential in applications that require real-time rendering, such as video games, virtual reality, and architectural visualization. The appearance of a translucent material is affected by the light transport inside it, so a rendering algorithm that can accurately simulate the propagation of light inside the material is required. The BSSRDF model can more realistically simulate the behavior of light in a translucent material, including scattering, absorption, and reflection. This model can greatly improve the realism and accuracy of the rendering, making the appearance of translucent materials more realistic. Algorithms that apply the BSSRDF model are generally called subsurface scattering algorithms. With the continuous upgrading of computer hardware and the continuous improvement of algorithms, subsurface scattering has been widely used in more application scenarios.

[0108] In the subsurface scattering algorithm, an important concept is the selection of irradiance samples on the surface of an object. Specifically, because subsurface scattering takes into account the propagation of light in an object, light entering an object from one surface point on the object will most likely leave the object from another surface point. In order to calculate the outgoing light result of a specific shading point, it is necessary to consider the incident light of a large number of surface points on the object and accumulate the contribution of these surface points to the result of the shading point. Considering the limitations of device hardware conditions and the requirements of real-time rendering, the complexity of the calculation can be reduced to a certain extent by selecting a number of sample points from all surface points.

[0109] In order to improve rendering efficiency without losing the authenticity and accuracy of rendering, the present application provides a rendering method, which is now introduced as follows.

[0110] During the rendering process, the electronic device can determine which object to be rendered belongs to the surface point based on the identification information of the surface point on the object to be rendered in the target graphic, and then use the irradiance of the surface point to construct different maps. The sample points used for rendering the target graphic are determined by sampling in different maps, and the irradiance and other information of these sample points can be used to complete the rendering of the target graphic.

[0111] S101 : Determine the irradiance of a second pixel according to identification information of M first pixels and the irradiance of the M first pixels.

[0112] Irradiance, which generally refers to the total radiation flux of a pixel, can be used to represent the interaction of light on the surface of an object in the scene to be rendered.

[0113] The identification information may also be referred to as a label, which refers to information that can be used to identify an object to be rendered, that is, different objects to be rendered have different corresponding identification information. The identification information of a first pixel may be used to indicate the object to be rendered to which the first pixel belongs, and the identification information of a second pixel may be used to indicate the object to be rendered to which the second pixel belongs. If the object to be rendered to which the first pixel belongs and the object to be rendered to which the second pixel belongs are the same object to be rendered, the identification information of the first pixel and the identification information of the second pixel are the same; otherwise, the two are different.

[0114] In some examples, the identification information can be a number, a character, a string, etc., for example, 0.1, 0.2, 0.5, or a, b, f, or asd, wer, jkl, etc.

[0115] In some examples, the identification information may be a preset value defined by a user.

[0116] Exemplarily, the target graphic includes an object A to be rendered and an object B to be rendered. If the user hopes that the object A to be rendered in the rendered target graphic can have a more realistic and natural display effect, the user can set a larger or smaller identification information for the object A to be rendered. In the subsequent rendering process, the identification information of the object A to be rendered can be used to identify the pixels corresponding to the object A to be rendered. The pixels corresponding to the object A to be rendered can be differentiated relative to the pixels corresponding to the object B to be rendered, thereby optimizing the rendering effect of the object A to be rendered.

[0117] In some examples, the identification information may be determined by an electronic device that renders the target graphics.

[0118] Exemplarily, in the pre-rendering channel stage, the electronic device may determine, based on the depth information of different objects to be rendered in the target graphics, that the identification information of the object to be rendered having the same depth information and containing the largest number of pixels may be set to a larger or smaller value.

[0119] By using identification information to identify the objects to be rendered to which different pixels belong, in the subsequent rendering process, especially in the stage of generating a low-resolution map using a high-resolution map, the identification information can be used to assist in determining the irradiance of the pixels in the low-resolution map, which is conducive to generating a low-resolution map that is closer to the high-resolution map. When the number of sample points used for rendering remains unchanged, this technical solution can improve the display effect of the target graphics finally rendered to a certain extent.

[0120] In some examples, the M first pixels include at least two first pixels with the same identification information, and the irradiance of the second pixel may be the average of the irradiances of the first pixels with the same identification information. The identification information of the second pixel may be the identification information of the first pixel with the same identification information.

[0121] Exemplarily, the value of M is 4, pixel A1, pixel A2, pixel A3 and pixel A4 all belong to the first pixel, the identification information of pixel A1, pixel A2 and pixel A3 is 0.3, and the identification information of pixel A4 is 0.2. Then, according to the above scheme, the identification information of the second pixel is 0.3, and the irradiance of the second pixel is the average of the irradiances of pixel A1, pixel A2 and pixel A3.

[0122] In some examples, identification information of any two first pixels among the M first pixels is different, the irradiance of the second pixel may be the irradiance of the target pixel, and the identification information of the second pixel may be the identification information of the target pixel. The target pixel is the first pixel with the highest priority of the object to be rendered among the M first pixels, and the priority of the object to be rendered can be determined based on the identification information.

[0123] Exemplarily, the value of M is 3, pixel B1, pixel B2 and pixel B3 all belong to the first pixel, the identification information of pixel B1, pixel B2 and pixel B3 are 8, 4, and 1 respectively, and the larger the value of the identification information, the higher the priority of the corresponding object to be rendered. According to the above scheme, the identification information of the second pixel is 8, and the irradiance of the second pixel is the irradiance of pixel B1.

[0124] Here, M first pixels and second pixels are all used to display graphics in the same area of ​​the target graphics. In other words, the identification information and irradiance of the second pixel are determined based on the identification information and irradiance of multiple first pixels in the area to be displayed by the second pixel.

[0125] The value of M can be determined according to the size of the first pixel and the distribution of the first pixel in the region. In some examples, the first pixels are squares of equal size and shape, and M can be 4, 9, 16, 25, etc. In some examples, the first pixels contain different types of pixels of different shapes and sizes, and M can be 3, 5, 8, etc. It should be noted that this application does not limit the value of M.

[0126] The aforementioned first pixel is located in the primary map and can also be called a primary pixel, and the second pixel is located in the secondary map and can also be called a secondary pixel. The irradiance of the secondary pixel is determined after filtering the irradiance of multiple primary pixels, that is, irradiance maps of different resolutions are constructed, and subsequent sample points can be selected from these different irradiance maps, which is beneficial to reducing the amount of samples used to render the target graphics and improving the rendering efficiency of the target graphics.

[0127] S102, determining a plurality of sample points from a plurality of first pixels and a plurality of second pixels.

[0128] The process of determining a plurality of sample points from a plurality of first pixels and a plurality of second pixels is a sampling process.

[0129] In some examples, the first pixel is located in the first map, the second pixel is located in the second map, the multiple sample points may include a first sample point and a second sample point, the first sample point is sampled from multiple first pixels in a first sampling area in the first map, and the second sample point is sampled from a second pixel in a second sampling area in the second map. Here, the second sampling area is located at the periphery of the first sampling area, or in other words, the second sampling area is arranged around the first sampling area.

[0130] The sample distribution pattern of the sampling surround in this technical solution is that the samples are distributed in a sampling area consisting of a central area and multiple peripheral annular areas. The samples in the central area are densely distributed, and the samples in the peripheral annular areas are sparsely distributed, which conforms to the rule of more accurate sampling in the adjacent area (or central area) and more coarse sampling in the distant area (or peripheral area). Compared with the fixed sampling method, this technical solution can improve the accuracy of the rendering results to a certain extent, which is conducive to improving the flexibility of rendering sample selection.

[0131] In some examples, the range of the first sampling area is based on the illumination direction, the normals at the first pixels, and the image to be rendered to which the first pixels belong.

[0132] In some examples, the first sampling area is a central area among multiple sampling areas. In this case, the range of the first sampling area can be determined according to the following formula:

[0133] C1=R·exp(-ε d·min(|n·ω|+0.5,1))·min(0.02σ t +0.5,1) (1)

[0134] Where C1 is the range of the primary sampling area, R is the first preset value, ε d is the second preset value, n is the normal at the first pixel, ω is the illumination direction, σ t is the extinction coefficient of the object to be rendered to which the first pixel belongs, min(|n·ω|+0.5,1) is used to calculate the minimum value between |n·ω|+0.5 and 1, min(0.02σ t +0.5,1) is used to calculate 0.02σ t Minimum value between +0.5 and 1.

[0135] In some examples, R may be used to indicate a maximum sampling range set by a user.

[0136] In the above formula, exp(-ε d min(|n·ω|+0.5),1) can represent the directional factor, which is mainly determined by the normal of the object surface and the direction of illumination. min(0.02σ t +0.5,1) may represent a scattering factor, which is mainly determined by the extinction coefficient of the object to be rendered. That is, the range of the first sampling area may be determined according to the normal of the object surface, the illumination direction, and the scattering coefficient of the object to be rendered.

[0137] In some examples, the side length of the second sampling region is twice the side length of the first sampling region.

[0138] It should be noted here that the outer contours of the first sampling area and the second sampling area can both enclose a square area. The side length of the first sampling area should be understood as the side length of the square area enclosed by the outer contour of the first sampling area, and the side length of the second sampling area should be understood as the side length of the area enclosed by the outer contour of the second sampling area.

[0139] In some examples, the side length of the second sampling area is 4 times, 8 times, 16 times, etc., the side length of the first sampling area. i times, where i is an integer greater than or equal to 2.

[0140] In this technical solution, when determining the range of the sampling area, factors such as the lighting direction of the light source information in the scene to be rendered, the geometric information of the object to be rendered, and the scattering coefficient corresponding to the material of the object to be rendered are comprehensively considered. This is conducive to determining a more appropriate sampling range, selecting more appropriate sample points, improving the rendering effect of the target graphics, and improving the rendering efficiency of the target graphics.

[0141] In some examples, the sampling step size (first-level sampling step size or first-level sample spacing) within the first sampling area is determined according to the size of the area covered by the light source space and the size of the bounding box of the object to be rendered.

[0142] In some examples, the first-level sampling step size is greater than or equal to the minimum pixel side length in the first-level map, and the resolution of the first-level map is greater than or equal to a preset threshold.

[0143] The restrictive conditions in the sampling process are provided here, which can be used to determine whether the sampling process can be terminated. Among them, the sampling step is not less than the side length of the smallest pixel in the first-level map, so that the sampled sample points contain an integer number of map pixels, and the resolution of the first-level map is limited to be greater than or equal to the preset threshold. The surface of the object to be rendered is fully refined, so that the area of ​​the surface of the object to be rendered corresponding to each pixel is small enough, which is conducive to improving the rendering efficiency of the target graphics.

[0144] In some examples, the sampling step size (secondary sampling step size or secondary sample spacing) in the second sampling region is twice the sampling step size in the first sampling region.

[0145] In some examples, the sampling step size of the second sampling area is 4 times, 8 times, 16 times, etc., the sampling step size of the first sampling area. j times, where j is a positive integer.

[0146] In this scheme, when determining the sampling step, the size of the object to be rendered, the size of the area covered by the light source space in the light source information, the first-level map resolution and other information are comprehensively considered, and the sampling step can be determined based on this information. The implementation of this scheme is conducive to determining a more appropriate sampling step, that is, it is conducive to determining a more appropriate sample distribution, it is conducive to selecting more appropriate sample points, it is conducive to improving the rendering effect of the target graphics, and it is conducive to improving the rendering efficiency of the target graphics.

[0147] S103, rendering the target graphics according to the irradiance of the multiple sample points.

[0148] In some examples, at least one object to be rendered contained in the target graphic is a semi-transparent object.

[0149] In some examples, the rendering process of the semi-transparent object may be inserted into the rendering process of the forward opaque object in the target graphics, or the rendering process of the semi-transparent object may be inserted into the post-processing process of the target graphics.

[0150] Figure 2 Some possible application scenarios of the rendering method provided by the embodiment of the present application are shown. Taking the 3D scene rendering pipeline process as an example, the rendering method provided by the embodiment of the present application can be applied in Figure 2The forward opaque object rendering link and / or post-processing link of the rendering pipeline shown in the figure, and a brief description of the multiple rendering steps involved in the rendering pipeline are given below.

[0151] In some examples, subsurface scattering calculations may include irradiance map processing, irradiance sample collection, and semi-transparent object rendering. Among them, irradiance map processing can be used to store the irradiance map of the surface of the object to be rendered, and use the information contained in the irradiance map to perform mipmap construction on the stored irradiance map to form multiple irradiance maps of different resolutions. Irradiance sample collection can adaptively sample the irradiance map through scene parameters such as light direction, object surface normal, scattering coefficient, and parameters of the object to be rendered, while maintaining high accuracy. Reduce the number of samples collected. The collected irradiance samples are used as input to the semi-transparent object rendering link to obtain the calculation results of subsurface scattering of the semi-transparent object.

[0152] In some examples, calculations for subsurface scattering can be inserted into the rendering of forward-facing opaque objects. This is because even for seemingly opaque objects, light may penetrate the surface to some extent and be scattered inside the object.

[0153] In some examples, subsurface scattering can be calculated in a post-processing step. This method is often called screen space subsurface scattering. Subsurface scattering can be considered a post-processing effect that is applied to the rendered image.

[0154] The pre-rendering channel, pre-rendering stage, pre-pass or prepass is the first rendering stage in the rendering process. Its main goal is to generate a depth map of the scene to be rendered, which records the depth of the nearest point traced by rays from the observation point to all directions of the view cone. The pre-rendering channel allows a lightweight rendering calculation to be performed before the actual rendering, so that which models will be displayed where can be determined in advance, and redundant rendering of pixel areas that are known to be blocked by objects rendered later can be avoided.

[0155] Decals are used to apply specific design elements, such as images or other textures, on top of the surface of an object. In some examples, decals can also be used for logos, annotations, or other content. The decal stage can increase the detail and realism of the scene to be rendered, and can be considered an efficient way to modify the appearance of the surface of an object.

[0156] The geometric buffer (G-buffer), also known as the G-buffer, is mainly used to store the position, normal, diffuse color, and other useful material parameters corresponding to each pixel. The geometric buffer can be a set of images prepared for each frame, which contains all the information to be used in the later stages of the rendering pipeline. In some examples, these images can be used to calculate other content needed in the rendering pipeline, which can be applied to the rendering of the scene to be rendered.

[0157] Ambient occlusion (AO) is a method of simulating indirect lighting and diffuse reflection in real life. The use of ambient occlusion can improve the realism of rendering effects by providing more realistic lighting effects for the rendered scene.

[0158] Screen space reflections (SSR) can be used to calculate the reflection of light in screen space. In some examples, screen space reflections can be applied in game graphics to provide higher visual quality and realism.

[0159] Light structure construction refers to the process of determining how light sources are handled and managed in the rendering pipeline. In some examples, light structure construction may include defining the type of light source (such as point light source, directional light source, spotlight, etc.), setting the properties of the light source (such as color, intensity, position, direction, etc.), and determining how to apply the light source to objects in the scene to be rendered.

[0160] Shadow map calculation can be used to generate shadows of objects in the scene to be rendered. This process can generally be divided into two steps: generating shadow maps and using shadow maps to generate shadows. Among them, generating shadow maps refers to the process of rendering the entire scene from the perspective of the light source and recording the obtained depth information. The depth information here or the minimum depth from the light source position to each point in the scene to be rendered is recorded in the shadow map. Using shadow maps to generate shadows refers to the process of rendering the scene from the perspective of the camera to determine whether each visible pixel in the scene to be rendered is in the shadow.

[0161] Since the resolution of the shadow map is limited, the calculated shadow may be distorted or aliased. In some examples, this problem can be improved by using cascaded shadow maps (CSM). The main principle of cascaded shadows is to divide the camera's view cone into several layers (cascades) according to a certain ratio. Each layer corresponds to a sub-view cone, and each layer calculates the relevant shadow map independently. The use of cascaded shadows can provide a more natural and realistic shadow effect for the scene to be rendered, and can be applied to complex scenes to be rendered that contain dynamic light sources.

[0162] Deferred lighting is a method of separating lighting calculations from traditional vertex and fragment shaders. The processing overhead of deferred lighting is proportional to the number of pixels receiving lighting, and has nothing to do with the number of objects to be rendered in the scene being rendered.

[0163] Skybox and global fog can be used to enhance the visual effects of the scene to be rendered. The skybox uses a cube or sphere to surround the entire scene, and then maps a high-definition texture (usually an environment image) to the inside of the cube or sphere to create a panoramic background. Global fog is a method for simulating atmospheric scattering effects. This method sets constant fog in areas closer to the camera than the base height, and sets exponential fog in areas above the base height. Both skybox and global fog can improve the visual effects of the scene to be rendered to a certain extent.

[0164] After using the skybox and global fog processing methods to improve the visual effect of the scene to be rendered, the rendering of transparent objects can be further performed. The color of the transparent object to be achieved can be obtained by mixing the color of the transparent object with the background color.

[0165] During the rendering process, color layering allows the color information of an object to be decomposed into multiple independent layers, such as light layer, color layer, reflection layer, diffuse layer, etc. Each of these layers can be edited and adjusted individually and synthesized into the final rendering result.

[0166] Distortion generally refers to the visual effect of changing the surface of an object by modifying the texture coordinates, which can be achieved by performing mathematical operations on the texture coordinates in the shader.

[0167] Post-processing refers to further processing of the rendered image at the final stage of the rendering pipeline to enhance the visual effect or achieve a specific visual effect. In some examples, post-processing may include one or more steps such as image effect processing, special effect addition, anti-aliasing, depth testing and blending, and final output.

[0168] Overlay usually refers to applying some effect or element to an existing rendering result. For example, when processing a video or image, the overlay technology can be used to add special effects or adjust the color of the video or image.

[0169] In some examples, the graphics drawing in the above rendering pipeline can be completed in a graphics processing unit (GPU), or in other words, the program code corresponding to the graphics drawing in the above rendering pipeline can be executed by the GPU.

[0170] In some examples, the data processing in the above rendering pipeline can be completed in a central processing unit (CPU), or in other words, the program code corresponding to the data processing in the above rendering pipeline can be executed by the CPU.

[0171] In some examples, the rendering result of the semi-transparent object can be synthesized by the calculation result of the transmitted light part, the calculation result of the highlight part, and the calculation result of the subsurface scattering part. Figure 3 Shown is a schematic diagram of a method for rendering a semi-transparent object provided in an embodiment of the present application.

[0172] S301, calculate the shadow map.

[0173] For the light source in the 3D scene, the shadow map is used to calculate the shadow effect in the scene, which can be used to calculate the rendering result of the object in the formal scene later. The highlight effect and diffuse reflection effect of the object can be calculated separately using the highlight reflection model and the diffuse reflection model.

[0174] S302A, calculate the transmitted light part result.

[0175] Transmitted light refers to light that passes through a translucent object and is refracted inside it, and then exits from the other side of the object. In some examples, the calculation of the transmitted light portion may include the following steps: determining the transmitted light source, calculating direct lighting and indirect lighting, solving the radiosity regression function, and mixing colors. Among them, the transmitted light source can be determined by the intersection operation of the light and the spatial object, the direct lighting can be quickly solved using rendering light, and the indirect lighting can be solved by integration.

[0176] S302B, calculate the highlight result.

[0177] Calculating the highlight part of the semi-transparent object can enhance the three-dimensionality and realism of the object. In some examples, the calculation of the highlight part may include the following steps: determining the light source, calculating the reflection angle, applying the lighting model, and mixing colors.

[0178] Specifically, determining the light source refers to determining the color and position of the light source. This information can be used to calculate the lighting conditions of each point on the surface of the object. The reflection angle can be determined by the normal of the surface of the object and the incident light, and the reflection angle can be used to determine the direction of the highlight. Commonly used illumination models include the Phong model and the Blinn-Phong model, which can be used to assist in calculating the color of each point on the surface of the object.

[0179] S302C, calculate the subsurface scattering part results.

[0180] In some examples, calculation of the subsurface scattering partial results may include: irradiance map processing, irradiance sample collection, and semi-transparent object rendering.

[0181] After the shadow map storage in S301 is completed, the irradiance result of the surface of the semi-transparent object can be calculated by the light source intensity and position information in the scene, and the calculation result is further stored in the irradiance map as an irradiance sample. Based on the irradiance map and combined with the object label as the semi-transparent object identifier, the irradiance map is hierarchically constructed and calculated, so that multiple irradiance maps can be output, wherein the resolution of the high-level map in two adjacent maps is smaller than the resolution of the low-level map, and the high-level map can be regarded as an approximate result of the low-level map.

[0182] After the hierarchical construction of the irradiance map is completed, the irradiance of multiple sample points can be obtained by sampling multiple irradiance maps through the multi-layer surround sampling mode. In some examples, the resolution of the irradiance map in the central area is higher, and the number of samples in the area is larger, and the resolution of the irradiance map in the area outside the central area is lower, and the number of samples in the area is smaller.

[0183] In some examples, the selection of sample points in different sampling areas can be determined according to the size of the sampling area and the sampling step (sample spacing) in the area, both of which can be adaptively adjusted by parameters in the scene and parameters of the translucent object.

[0184] In some examples, the range of the sampling area can be determined based on the size of the semi-transparent object and the coverage area size of the light source space in the scene.

[0185] In some examples, the sampling step size may be determined based on the normal of the surface of the translucent object and the scattering coefficient of the translucent object itself.

[0186] For the irradiance of the sample points determined in the above steps, the subsurface scattering results can be calculated for these irradiance samples. In some examples, the subsurface scattering results can be determined according to the BSSRDF calculation model, which can calculate and accumulate the contributions of multiple sample points to output the subsurface scattering calculation results. The time consumption of subsurface scattering result calculation is related to the number of irradiance samples. When the number of irradiance samples decreases, the calculation time of subsurface scattering results is shortened.

[0187] S303, post-processing.

[0188] After determining the calculation results of the transmitted light part, the calculation results of the highlight part, and the calculation results of the subsurface scattering part, the three calculation results are superimposed to obtain the rendering result of the semi-transparent object. In some examples, after determining the superposition result of the above three calculation results, the superposition result can also be processed by an effect enhancement type post-processing method to improve the display effect of the rendered semi-transparent object.

[0189] Take the subsurface scattering result inserted into the rendering of the forward opaque object as an example. Figure 4 Another rendering method provided in an embodiment of the present application is shown. The rendering method of inserting the subsurface scattering result into the post-processing rendering link can be executed for reference.

[0190] In some examples, the rendering pipeline process corresponding to the rendering method provided in the present application can be run on a computer with a GPU and a CPU to achieve real-time rendering of three-dimensional scenes including objects with translucent materials.

[0191] In some examples, the above rendering pipeline process can be implemented based on Unity. In the simplified SRP rendering pipeline of the Unity engine, the calculation of the irradiance map for storing irradiance samples on the surface of semi-transparent objects is performed together with the calculation of the shadow map after the light source structure construction stage. In this rendering pipeline, the irradiance map calculation process, the hierarchical construction process, the adaptive sampling process, and the forward semi-transparent object rendering process are performed in sequence.

[0192] In some examples, the above rendering pipeline process can also be implemented based on other rendering engines (such as Unreal Engine, Source Engine, or Frostbite Engine, etc.), and the embodiments of the present application are not limited to this.

[0193] The irradiance map calculation process is used to calculate and store the irradiance of the surface of a semi-transparent object in a given light source space. The hierarchical construction process is used to construct mipmaps for the irradiance map to approximate the original map using multiple maps with smaller resolutions. The adaptive sampling process is used to sample the irradiance map, and the sampling mode can be determined based on the scene parameters and the semi-transparent object parameters. The forward semi-transparent object rendering process is used to calculate the subsurface scattering of the object based on the irradiance samples.

[0194] S401, pre-rendering channel.

[0195] The pre-rendering pass is the first rendering stage in the rendering process. Its main goal is to generate a depth map of the scene to be rendered. The depth map records the depth of the nearest point traced by rays from the observation point to all directions of the viewing cone. Through the pre-rendering pass, a lightweight rendering calculation can be performed before the actual rendering, so that which models will be displayed where can be determined in advance, and redundant rendering of pixel areas that are known to be blocked by objects rendered later can be avoided.

[0196] S402, constructing a light source structure.

[0197] Light structure construction refers to the process of determining how light sources are handled and managed in the rendering pipeline. In some examples, light structure construction may include defining the type of light source (such as point light source, directional light source, spotlight, etc.), setting the properties of the light source (such as color, intensity, position, direction, etc.), and determining how to apply the light source to objects in the scene to be rendered.

[0198] S403, irradiance map calculation.

[0199] This step is performed after the light source structure building module of the SRP pipeline is completed. In the subsurface scattering calculation, the interaction result of light on the surface of a translucent object can be quantified using irradiance. In this example, after the light shines on the surface point of the translucent object, the irradiance generated can be calculated based on formula (2). Then, the calculated irradiance result is stored in a two-dimensional map for subsequent sampling. This map is the irradiance map.

[0200]

[0201] Where E represents the irradiance of point P on the surface of the object to be rendered, I represents the radiation intensity, assuming that point P is on a sphere, r represents the radius of the sphere, dA is a surface element at point P on the sphere, and θ is the angle between the straight line from the center of the sphere to point P and the normal at the surface element dA.

[0202] In some examples, in addition to storing irradiance, additional information about the surface of some objects can also be optionally stored in the irradiance map. The stored information includes the position of the surface point, the direction of the refracted light, the surface normal of the object, etc. This information can be used later for more accurate BSSRDF calculation model evaluation.

[0203] In some examples, in order to distinguish different translucent objects, all translucent objects in the three-dimensional scene are set with different identification information, and the identification information can be used to determine the translucent objects in the scene to be rendered. In some examples, the identification information can also be stored in the irradiance map.

[0204] S404, hierarchical construction.

[0205] This step is performed after the irradiance map is calculated. For the irradiance map of the original resolution, this solution constructs mipmaps to simulate the hierarchical construction of irradiance samples.

[0206] Specifically, starting from the original resolution map, this solution uses a box filter to average the information stored in four adjacent pixels. After filtering the entire map, the new map resolution can be half of the original map resolution, where the information stored in each pixel in the new map can be regarded as an average approximation of the four pixels of the original map. This new map is used as a higher-level irradiance map. Similarly, the new map is further box-filtered to obtain a higher-level approximate irradiance map.

[0207] For example, Figure 5 As shown, the primary irradiance map 510 is a map with original resolution, and the primary irradiance map 510 includes a plurality of primary map pixels 511, and the plurality of primary map pixels 511 are arranged in an array. The first map pixel 501, the second map pixel 502, the third map pixel 503, and the fourth map pixel 504 are four map pixels arranged in a grid and adjacent to each other in the plurality of primary map pixels 511.

[0208] The relationship between the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 can also be understood as follows: the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 are respectively used to indicate the first sub-region, the second sub-region, the third sub-region and the fourth sub-region in the primary irradiance map. The first sub-region, the second sub-region, the third sub-region and the fourth sub-region are all located in the first region of the primary irradiance map 510, or in other words, the first sub-region, the second sub-region, the third sub-region and the fourth sub-region together constitute the first region of the primary irradiance map 510. From this perspective, the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 can all indicate the first region of the primary irradiance map 510.

[0209] The following takes the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 as examples to illustrate the process of determining the secondary irradiance map 520 from the primary irradiance map 510 and determining the tertiary irradiance map 530 from the secondary irradiance map 520.

[0210] In the process of hierarchical construction, the secondary irradiance map 520 is first generated using the primary irradiance map 510 with the original resolution. The secondary irradiance map 520 is composed of a plurality of secondary map pixels 512 arranged in an array, and the secondary map pixels 512 can be determined according to a plurality of primary map pixels 511 used to display the same area. Exemplarily, the plurality of secondary map pixels 512 include a fifth map pixel 505, and the identification information and irradiance of the fifth map pixel 505 can be determined according to the identification information and irradiance of the aforementioned first map pixel 501, the second map pixel 502, the third map pixel 503, and the fourth map pixel 504. The fifth map pixel 505 can indicate the second area in the secondary irradiance map 520.

[0211] The position of the fifth map pixel 505 in the secondary irradiance map 520 has a corresponding relationship or a mapping relationship with the positions of the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 in the primary irradiance map 510. In other words, the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 can all indicate the first area in the primary irradiance map 510, and the fifth map pixel 505 can indicate the second area in the secondary irradiance map 520. The position of the first area in the primary irradiance map 510 corresponds to the position of the second area in the secondary irradiance map 520, and the first area and the second area both indicate the same area of ​​the target graphic. In other words, the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 indicate the target area of ​​the target graphic, and the fifth map pixel 505 also indicates the target area of ​​the target graphic.

[0212] Exemplarily, the pixels in the irradiance map can be represented by coordinates. For example, the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 can be represented by (x1, y1), (x2, y2), (x3, y3) and (x4, y4), respectively, and the fifth map pixel 505 can be represented by (x5, y5). In this way, the corresponding relationship between the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 and the fifth map pixel 505 can also be understood as: the mapping relationship between the coordinates (x1, y1), (x2, y2), (x3, y3) and (x4, y4) and the coordinates (x5, y5).

[0213] The process of generating the tertiary irradiance map 530 using the secondary irradiance map 520 is similar to the process of generating the secondary irradiance map 520 using the primary irradiance map 510 described above. The tertiary irradiance map 530 includes a plurality of tertiary map pixels 513 arranged in an array. Taking the sixth map pixel 506 in the tertiary map pixel 513 as an example, the sixth map pixel 506 can be determined by the four secondary map pixels 512 used to display the same area. Specifically, the identification information of the sixth map pixel 506 can be determined by the identification information of the four secondary map pixels 512 used to display the same area, and the irradiance of the sixth map pixel 506 can be determined by the identification information and irradiance of the four secondary map pixels 512 used to display the same area.

[0214] The generation process of the higher-level irradiance map is similar to the generation process of the secondary irradiance map 520 and the tertiary irradiance map 530, and is not described here for brevity.

[0215] It should be noted that the irradiance of the secondary map pixel 512 can also be determined by the identification information and irradiance of more or fewer primary map pixels 511. Exemplarily, the irradiance of the secondary map pixel 512 can be determined by the identification information and irradiance of three primary map pixels 511. Also exemplarily, the irradiance of the secondary map pixel 512 can also be determined by the identification information and irradiance of nine primary map pixels 511. This application is not limited to this.

[0216] In some examples, the hierarchical construction process can result in 3-4 irradiance maps of different levels and resolutions.

[0217] In some examples, during the box filtering of a map, identification information corresponding to different map pixels can be used to filter and average the irradiance information on the same translucent object. In other words, the box filtering process only filters and averages the irradiance information of pixels with the same identification information.

[0218] Exemplarily, when the identification information in one or two pixels among four adjacent map pixels is different from the identification information in the remaining pixels, the pixels with the same identification information among the four map pixels are averaged, and the pixels with different identification information are ignored.

[0219] Similarly, illustratively, when the identification information of four adjacent map pixels is different, only the pixel information corresponding to the semi-transparent object with a higher priority is retained as output during the filtering process, without performing an average calculation. As an example and not a limitation, the priority of the semi-transparent object can be determined based on the identification information. For example, the identification information can be a natural number. The higher the priority of the semi-transparent object, the larger the value of the identification information corresponding to the semi-transparent object. In this way, the semi-transparent object with the highest priority can be determined by selecting the identification information with the largest value among multiple identification information.

[0220] The above process of determining the secondary irradiance map 520 from the primary irradiance map 510 can also be understood as the process of determining the secondary pixel 512 in the secondary irradiance map 520 from the primary map pixel 511 in the primary irradiance map 510. Similarly, the process of determining the tertiary irradiance map 530 from the secondary irradiance map 520 can also be understood as the process of determining the tertiary pixel 513 in the tertiary irradiance map 530 from the secondary map pixel 512 in the secondary irradiance map 520.

[0221] It should be noted that the first map pixel 501, the second map pixel 502, the third map pixel 503 and the fourth map pixel 504 in S404 are only used to illustrate the construction process of irradiance maps at different levels. Their selection is exemplary and should not be understood as a limitation on the sampling area in the following S405.

[0222] S405, adaptive sampling.

[0223] This step is performed after the hierarchical construction module is completed, and is used to sample the irradiance map to obtain a suitable irradiance sample. This scheme adopts a surrounding sample distribution pattern, and the sampling area consists of a central area and several levels of annular areas in the outer layer. Among them, the central area is sampled on the first-level irradiance map with the highest resolution. The outer annular area adjacent to the central area is sampled on the second-level irradiance map, and the other annular area located on the side of the annular area away from the central area is sampled on the third-level irradiance map, and so on. For the sake of convenience, the central area is referred to as the first-level sampling area below, and the sampling areas outside the central area and away from the central area are referred to as the second-level sampling area, the third-level sampling area, and the fourth-level sampling area from near to far.

[0224] For example, Figure 6 As shown, the primary sampling area 610 is located in the middle of the secondary sampling area 620, and the tertiary sampling area 630 is located at the periphery of the secondary sampling area 620. The primary sampling area 610 can be regarded as a part of the aforementioned primary irradiance map, the secondary sampling area 620 can be regarded as a part of the aforementioned secondary irradiance map, and the tertiary sampling area 630 can be regarded as a part of the aforementioned tertiary irradiance map.

[0225] In some examples, the range of the primary sampling area may be determined according to the size of the semi-transparent object to be rendered and the size of the coverage area of ​​the light source space in the scene.

[0226] For example, given the sampling range max_range set by the user, the target shading point is projected in the coordinate system of the irradiance map, and the above-mentioned surrounding sample distribution pattern is constructed with the projection point as the center. The range of the primary sampling area can be calculated according to the following formula:

[0227] C0=max_range·C d ·C t (3)

[0228] C d =exp(-ε d ·min(|n·ω|+0.5,1)) (4)

[0229] C t =min(0.02σ t +0.5,1) (5)

[0230] Where C0 represents the range of the primary sampling area, which is affected by two factors. d represents the directional factor, where εd is a user-adjustable threshold, such as 0.5. n is the normal of the object surface, Indicates the direction of light. Ct represents the scattering factor. In the calculation formula, σ t It represents the extinction coefficient of a semi-transparent object. From this, the range of the primary sampling area can be obtained.

[0231] In some examples, the sampling step size within the primary sampling area may be determined based on one or more of the direction of light in the scene, the normal of the surface of the semi-transparent object to be rendered, and the scattering coefficient of the semi-transparent object to be rendered.

[0232] Figure 7 A method for calculating a sampling step length within a primary sampling area is exemplarily provided.

[0233] S701, input initial parameters.

[0234] Including the user-defined threshold εs (for example, 0.004), the area size A covered by the light space, the bounding box size R of the semi-transparent object, the minimum resolution T in the irradiance map level, the maximum pixel edge length sn in the irradiance map level, and the minimum pixel edge length s0 in the irradiance map level. Initially, the sampling step s is set to sn;

[0235] S702, perform calculation.

[0236] Reduce s to 1 / 2 of the original value and increase T to twice the original value, that is, s = s / 2, T = 2*T;

[0237] S703, execute judgment.

[0238] Determine whether A / T is less than R*εs, or whether the current s is less than s0. If any of the above conditions are met, the algorithm ends and outputs the sampling step s; if neither of the above conditions is met, return to step S702 to continue the calculation. Here, It can be regarded as the threshold of the resolution T. In other words, the premise for S702 to be repeatedly executed is that the resolution T is less than or equal to the preset threshold. And the sampling step s is greater than or equal to the side length s0 of the smallest pixel.

[0239] After determining the range and sampling step of the primary sampling area, the coordinates of each sample on the map can be calculated. Based on the coordinates, sampling is performed on the primary irradiance map to obtain the first part of the irradiance sample information.

[0240] In some examples, the secondary sampling area is located outside the primary sampling area, and the side length of the secondary sampling area is twice the side length of the primary sampling area. The sampling step length in the secondary sampling area is twice the sampling step length in the primary sampling area. Similarly, the tertiary sampling area is located outside the secondary sampling area, and the side length of the tertiary sampling area is twice the side length of the secondary sampling area, and the sampling step length in the tertiary sampling area is twice the sampling step length in the secondary sampling area. And so on, until the range of N (N is a positive integer) sampling areas can cover the sampling range max_range specified by the user.

[0241] According to the sampling step size and range of the secondary sampling area, the coordinates of the samples in the secondary sampling area on the map can be determined. According to the coordinates, sampling can be performed on the secondary irradiance map to obtain the second part of the irradiance sample information. Similarly, sampling can be performed on the tertiary irradiance map to obtain the third part of the irradiance sample information.

[0242] By sampling at different levels of irradiance sample maps, multiple irradiance sample information can be obtained, and these irradiance sample information can be used to render opaque objects to be rendered.

[0243] S406, forward semi-transparent object rendering.

[0244] This step is performed after the adaptive sampling module is completed. Subsurface scattering calculations are generally evaluated and calculated using the known BSSRDF model. Generally speaking, this model requires the irradiance information of several sample points as input, and calculates and accumulates its contribution. This solution directly specifies the sample points required in the evaluation process as the sample points sampled in the previous step to achieve acceleration in the subsurface scattering calculation process. Finally, the surface scattering results are added to the refraction light results and highlight results to obtain the final rendered image output.

[0245] S407, forward opaque object rendering.

[0246] The depth information of the surface points of different objects in the scene to be rendered can be used to determine the occlusion relationship between different objects, and then the color information of different pixel points in the scene to be rendered can be determined, thereby completing the rendering of different bright objects.

[0247] S408, skybox and global fog.

[0248] Skybox and global fog can be used to enhance the visual effects of the scene to be rendered. The skybox uses a huge cube or sphere to surround the entire scene, and then maps a high-definition texture (usually an environment image) to the inside of this cube or sphere to create a panoramic background. Global fog is a way to simulate the effect of atmospheric scattering. This method sets constant fog in areas closer to the camera than the base height, and sets exponential fog in areas above the base height. Both skybox and global fog can improve the visual effects of the scene to be rendered to a certain extent.

[0249] S409, transparent object rendering.

[0250] After using the skybox and global fog processing methods to improve the visual effect of the scene to be rendered, the rendering of transparent objects can be further performed. The color of the transparent object to be achieved can be obtained by mixing the color of the transparent object with the background color.

[0251] S410, post-processing.

[0252] The display effect of the final displayed target graphics can be improved through different post-processing methods, which may include one or more of the following: color correction, depth blur, motion blur, global illumination, ambient occlusion, glow and bloom, screen space reflection and refraction, and tone mapping.

[0253] S411, shadow map calculation.

[0254] For the light source in the 3D scene, the shadow map is used to calculate the shadow effect in the scene, which can be used to calculate the rendering result of the object in the formal scene later. The highlight effect and diffuse reflection effect of the object can be calculated separately using the highlight reflection model and the diffuse reflection model.

[0255] S412, Cascade Shadows.

[0256] Since the resolution of the shadow map is limited, the calculated shadow may be distorted or aliased. In some examples, this problem can be improved by cascading shadows. The main principle of cascaded shadows is to divide the camera's view cone into several layers in a certain proportion, each layer corresponds to a sub-view cone, and each layer calculates the relevant shadow map independently. The use of cascaded shadows can provide a more natural and realistic shadow effect for the scene to be rendered, and can be applied to complex scenes to be rendered that contain dynamic light sources.

[0257] By rendering multiple graphics using the rendering method provided by the present application and other rendering methods respectively, the rendering results shown in Table 1 below can be obtained. The hardware devices used by different rendering methods are the same.

[0258] Table 1

[0259] Rendering Method Figure 1 Figure 2 Figure 3 Figure 4 The rendering method provided by this application 112fps 122fps 89fps 86fps Other rendering methods 76fps 82fps 57fps 61fps

[0260] By comparing the two rendering results in Table 1, it can be seen that the rendering method provided by the present application can output more pictures per unit time (ie, a higher frame rate) and has a higher rendering efficiency.

[0261] The rendering method provided in the embodiment of the present application can be used not only for rendering of three-dimensional graphics to be rendered, but also for rendering of two-dimensional graphics to be rendered. In some examples, the rendering method provided in the embodiment of the present application can be used to render a user interface containing a blur effect in an application of an electronic device, such as a user interface containing a Gaussian blur or a mirror blur. Figures 8 to 10 Some examples are provided.

[0262] like Figure 8The user interface 800 of the drop-down status bar of the electronic device is shown, or the first user interface 800. The first user interface 800 may include a first fuzzy display area 801 and a first control display area 802. The first fuzzy display area 801 may be obtained by blurring the background of the first user interface 800 using the rendering method provided in the present application. The first control display area 802 may be used to display one or more functional controls on the first user interface 800, for example, a "Bluetooth switch" functional control, a "media control" functional control, etc. In some examples, the first fuzzy display area 801 may be located in a first layer, the first control display area 802 may be located in a second layer, and the second layer is displayed on the first layer.

[0263] like Fig. 9 The user interface 900 of the negative first screen of the electronic device is shown, or the second user interface 900. The second user interface 900 may include a second fuzzy display area 901 and a second control display area 902. The second fuzzy display area 901 may be obtained by blurring the background of the second user interface 900 using the rendering method provided in the present application. The second control display area 902 may be used to display one or more function controls on the second user interface 900, such as a "payment code" function control, a "scenario intelligence" function control, etc. In some examples, the second fuzzy display area 901 may be located in a third layer, and the second control display area 902 may be located in a fourth layer, and the fourth layer is displayed on the third layer.

[0264] like Fig.10 Shown is a user interface 1000 of a recent task of an electronic device, or a third user interface 1000 .

[0265] The third user interface 1000 may include a third fuzzy display area 1001 and a third control display area 1002. The third fuzzy display area 1001 may be obtained by blurring the background of the third user interface 1000 using the rendering method provided in the present application. The third control display area 1002 may be used to display one or more functional controls on the third user interface 1000, such as a preview window of application 1, a preview window of application 2, etc. In some examples, the third fuzzy display area 1001 may be located in the fifth layer, the third control display area 1002 may be located in the sixth layer, and the sixth layer is displayed on the fifth layer.

[0266] Figures 8 to 10 Only some graphical user interfaces of electronic devices to which the rendering method provided in the present application can be applied are provided as examples. It should be understood that the rendering method provided in the embodiments of the present application can also be applied to the rendering processes of more graphical user interfaces, such as the application drawer user interface, the notification bar drop-down interface, and the lock screen password input interface, etc. The present application does not impose any restrictions on this.

[0267] Based on similar principles, Fig.11 The computer program software 1100 provided in an embodiment of the present application is shown. The computer program software 1100 can be applied to rendering scenarios such as three-dimensional simulation, virtual reality games, and visualization platform software. In some examples, the code of the computer program software 1100 can be included in the runtime engine, memory management, rendering pipeline process, etc. of the platform software. During the rendering process, the code of the computer program software 1100 can run in the host memory and GPU memory of the local end.

[0268] like Fig.11 As shown, the computer program software 1100 may include a software application programming interface 1110, a geometry stage processing module 1120 and a rasterization stage processing module 1130. Among them, the geometry stage processing module 1120 may include a vertex shader submodule 1121, a tessellation shader submodule, a geometry shader submodule, a culling submodule, and a screen mapping submodule. The rasterization stage processing module 1130 may include a triangle initialization submodule, a triangle traversal submodule, a geometry shader submodule 1131 and a fragment operation submodule. The fragment operation submodule may also include a template test submodule, a depth test submodule and a blending submodule.

[0269] In the geometry stage processing module 1120, the vertex shader submodule 1121 can be used to process the surface parameter information of the semi-transparent object and the light source parameter information in the scene. In the rasterization stage processing module 1130, the geometry shader submodule 1131 can be used to perform various operations such as hierarchical clustering of irradiance maps, adaptive sampling of maps, and calculation of subsurface scattering results for semi-transparent objects.

[0270] Fig.12 The present invention provides a rendering device 1200, which may have the functions of the electronic device in the above method embodiment, and may be used to execute the steps performed by the functions of the electronic device in the above method embodiment. The functions may be implemented by hardware, or by software or hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0271] In a possible implementation, the rendering device 1200 may include an acquisition module 1210 and a processing module 1220 , and the acquisition module 1210 and the processing module 1220 are coupled to each other.

[0272] The acquisition module 1210 can be used to support the electronic device in acquiring user input. The acquisition module 1210 can also be used to support the electronic device in communicating, such as acquiring relevant information of the target graphic before rendering the target graphic.

[0273] The processing module 1220 is used to support the electronic device to execute the processing actions in the above method embodiments, such as executing operations such as hierarchical construction and adaptive sampling.

[0274] Optionally, the rendering device 1200 may further include a storage unit 1230 for storing program codes and data of the rendering device 1200 .

[0275] Fig.13 An electronic device 1300 provided in an embodiment of the present application, as shown in the figure, includes: at least one processor 1310 and a transceiver 1320. The processor 1310 is coupled to a memory and is used to execute instructions stored in the memory to control the transceiver 1320 to send and / or receive signals.

[0276] Optionally, the electronic device 1300 further includes a memory 1330 for storing instructions.

[0277] In some embodiments, the processor 1310 and the memory 1330 may be combined into a processing device, and the processor 1310 is used to execute the program code stored in the memory 1330 to implement the above functions. In specific implementation, the memory 1330 may also be integrated into the processor 1310, or independent of the processor 1310.

[0278] In some embodiments, the transceiver 1320 may include a receiver (or receiver) and a transmitter (or transmitter).

[0279] The transceiver 1320 may further include an antenna, and the number of antennas may be one or more. The transceiver 1320 may be a communication interface or an interface circuit.

[0280] When the electronic device 1300 is a chip, the chip includes a transceiver module and a processing module, wherein the transceiver module may be an input / output circuit or a communication interface; and the processing module may be a processor or a microprocessor or an integrated circuit integrated on the chip.

[0281] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0282] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0283] In the several embodiments provided in the present application, it should be understood that the disclosed systems, 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 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 system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

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

[0286] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.

[0287] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A graphics rendering method, applied to an electronic device, characterized in that: The method comprises: Determine a secondary map according to the primary map, wherein the irradiance of each secondary pixel in the secondary map is determined according to the identification information and irradiance of M primary pixels in the primary map, the M primary pixels and the corresponding secondary pixels indicate the same area of ​​the target graphic, the identification information of the primary pixel is used to indicate the object to be rendered to which the primary pixel belongs, and M is an integer greater than or equal to 2; Determine a plurality of sample points from the plurality of primary pixels and the plurality of secondary pixels; The target graphic is rendered according to the irradiance of the multiple sample points.

2. The method according to claim 1, characterized in that In the case where there are at least two primary pixels with the same identification information among the M primary pixels, the irradiance of the secondary pixel is the average irradiance of the primary pixels with the same identification information; or, When there are no two primary pixels with the same identification information among the M primary pixels, the irradiance of the secondary pixel is the irradiance of the target pixel, and the target pixel is the primary pixel with the highest priority among the M primary pixels and belongs to the object to be rendered, and the priority of the object to be rendered is determined according to the identification information.

3. The method according to claim 1 or 2, characterized in that: The step of determining a plurality of sample points from a plurality of primary pixels and a plurality of secondary pixels comprises: Determine a first sample point within a sampling area of ​​the primary map; Determining a second sample point within the sampling area of ​​the secondary map; The multiple sample points include a first sample point and a second sample point, and the sampling area of ​​the secondary map is arranged around the sampling area of ​​the primary map.

4. The method according to claim 3, characterized in that The range of the sampling area of ​​the primary map is determined according to the illumination direction, the normals at the plurality of primary pixels and the scattering coefficient of the object to be rendered to which the primary pixels belong.

5. The method according to claim 4, characterized in that The range of the sampling area in the primary map is determined according to the following formula: C1=R·exp(-ε d ·min(|n·ω|+0.5,1))·min(0.02σ t +0.5,1); Wherein, C1 is the range of the primary sampling area, R is the first preset value, ε d is the second preset value, n is the normal at the primary pixel, ω is the illumination direction, σ t is the extinction coefficient of the object to be rendered to which the primary pixel belongs.

6. The method according to claim 5, characterized in that The outer boundaries of the sampling area of ​​the primary map and the outer boundaries of the sampling area of ​​the secondary map are both enclosed in a square, and the side length of the sampling area of ​​the secondary map is twice the side length of the sampling area of ​​the primary map.

7. The method according to any one of claims 3 to 6, characterized in that The determining the first sample point within the sampling area of ​​the first-level map includes: In the sampling area of ​​the primary map, the first sample point is determined according to a primary sampling step size, and the primary sampling step size is determined according to the size of the area covered by the light source space and the size of the bounding box of the object to be rendered.

8. The method according to claim 7, characterized in that The first-level sampling step length is greater than or equal to the minimum pixel side length in the first-level map, and the resolution of the first-level map is greater than or equal to a preset threshold.

9. The method according to claim 7 or 8, characterized in that: The determining the second sample point in the sampling area of ​​the secondary map includes: In the sampling area in the secondary map, the second sample point is determined according to the secondary sampling step length, and the secondary sampling step length is twice the primary sampling step length.

10. The method according to any one of claims 1 to 9, characterized in that M=4。 11. The method according to any one of claims 1 to 10, characterized in that The identification information of each secondary pixel in the secondary map is determined according to the identification information of M primary pixels in the primary map, In the case that there are at least two primary pixels with the same identification information among the M primary pixels, the identification information of the secondary pixel is the identification information of the primary pixels with the same identification information; or, When there are no two primary pixels with the same identification information among the M primary pixels, the identification information of the secondary pixel is the identification information of the target pixel, and the target pixel is the primary pixel with the highest priority among the M primary pixels and belongs to the object to be rendered, and the priority of the object to be rendered is determined according to the identification information.

12. The method according to any one of claims 1 to 11, characterized in that The identification information of the primary pixel is a preset value. When there are multiple objects to be rendered, different objects to be rendered in the at least one object to be rendered have different identification information corresponding to them.

13. The method according to any one of claims 1 to 12, characterized in that The at least one object to be rendered is a semi-transparent object.

14. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to call the program instructions to execute the method according to any one of claims 1 to 13.

15. A graphics rendering device, characterized in that: The invention comprises a rendering engine for implementing the method according to any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a computer, the method according to any one of claims 1 to 13 is implemented.

17. A chip, characterized in that: The chip comprises a processor and a memory, wherein the processor is used to read instructions stored in the memory, and when the processor executes the instructions, the chip implements the method according to any one of claims 1 to 13.

Citation Information

Cited By

  • XR shed-based refined three-dimensional modeling method and system

    CN120182511A

  • A refined three-dimensional modeling method and system based on an XR shed

    CN120182511B