Graphical rendering method and apparatus

By considering the illumination distribution and importance resampling within the ray neighborhood in the path tracing algorithm, the ray path selection is optimized, solving the problems of low efficiency and high computational cost in existing ray tracing technologies, and achieving a more efficient rendering process.

CN115861516BActive Publication Date: 2026-11-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111115206.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-23
Publication Date
2026-11-20
Estimated Expiration
2041-09-23

AI Technical Summary

Technical Problem

Existing path tracing algorithms only consider the material properties of objects during the rendering process, ignoring the lighting distribution, resulting in low ray tracing efficiency and high computational cost.

Method used

By determining the illumination distribution in the neighborhood where the light rays intersect with the object, the importance resampling method is used to adjust the light ray path to take into account material properties and illumination distribution, thereby optimizing the selection of the light ray path.

Benefits of technology

It improves the efficiency of ray tracing, reduces computational costs, and enhances sampling convergence speed and rendering quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115861516B_ABST
    Figure CN115861516B_ABST
Patent Text Reader

Abstract

The application provides a graphics rendering method and device, the method comprising: determining a first vertex of intersection of a light ray and an object; determining a neighborhood of the light ray, the neighborhood having a similar light distribution to the first vertex of the light ray; determining a light distribution of incident light of the light ray in the neighborhood, the light distribution of the incident light being similar to the light distribution in the neighborhood; determining a second vertex of the light ray based on the light distribution of the incident light; and determining a path of the light ray based on the first vertex and the second vertex. Thus, the obtained path is more efficient and the calculation cost is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of graphics processing, and more specifically, to graphics rendering methods and apparatus. Background Technology

[0002] Currently, most offline renderers use path-based ray tracing algorithms for rendering. This algorithm is intuitive and easy for engineers to understand, and it has rigorous mathematical theoretical proofs for the rendering results. It can render photorealistic images and is widely favored by the industry.

[0003] In path tracing algorithms, path finding typically involves pre-setting an importance sampling function based on the object's material properties; that is, determining the sampling weight of the light's incident direction given its outgoing direction. This importance sampling method is more effective at finding efficient light paths than random uniform sampling. However, the light contribution value depends not only on the object's material but also on the lighting distribution within the scene. If the incident direction of a surface with high reflectivity happens to be relatively dark, this importance sampling method will be inefficient.

[0004] Therefore, finding efficient ray tracing paths has become a technical problem that needs to be solved. Summary of the Invention

[0005] This application provides a graphics rendering method and apparatus that determines the path of light rays based on the illumination distribution within the effective neighborhood, thereby making the obtained path more efficient and saving computational costs.

[0006] In a first aspect, a graphics rendering method is provided, the method comprising: determining a first vertex where a ray intersects with an object; determining a neighborhood of the ray, wherein the illumination distribution within the neighborhood is similar to the illumination distribution of the first vertex of the ray; determining the illumination distribution of incident light on the ray within the neighborhood, wherein the illumination distribution of incident light is similar to the illumination distribution within the neighborhood; determining a second vertex of the ray based on the illumination distribution of incident light; and determining the path of the ray based on the first vertex and the second vertex.

[0007] According to the graphics rendering method provided in this application, the renderer can determine the path of light rays based on the illumination distribution within the effective neighborhood. Compared with the prior art, which only considers the material properties of objects when determining the path of light rays, the technical solution of this application fully considers the influence of material properties and illumination distribution, thereby making the obtained path more efficient and saving computational costs.

[0008] In this application, for example, the renderer can perform the methods described above.

[0009] In conjunction with the first aspect, in some embodiments of the first aspect, determining the second vertex of the ray based on the illumination distribution of the incident light includes: performing importance resampling based on the illumination distribution function of the incident light of the ray in the neighborhood and the weights of the incident light of the ray in the neighborhood; and obtaining the second vertex of the ray through the importance resampling method.

[0010] Based on the above technical solution, this application can resample the light rays within the neighborhood without incurring any computational costs other than resampling. Furthermore, the resampled light rays have a similar illumination contribution distribution to the first vertex of the current light ray, which can effectively improve the sampling convergence speed.

[0011] In conjunction with the first aspect, in some embodiments of the first aspect, the method further includes: acquiring illumination parameters of the first vertex and the second vertex; determining the reflectivity of the first vertex and the illumination intensity of the first vertex based on the illumination parameters; and determining the illumination intensity of the reflected light from the first vertex based on the reflectivity of the first vertex and the illumination intensity.

[0012] In conjunction with the first aspect, in some embodiments of the first aspect, the illumination parameters include: the direction of incident light at the first vertex and the second vertex, the incident light intensity, the sampled two-way scattering distribution function (BSDF), and the sampled probability density function (PDF).

[0013] Based on the above technical solution, the illumination parameters of the first vertex and the second vertex can be obtained in this application, so that they can be directly used in the recoloring process of neighborhood sampling, thereby enabling the rapid and effective recalculation of the reflectivity and illumination intensity of the first vertex.

[0014] In conjunction with the first aspect, in some embodiments of the first aspect, the reflectivity of the first vertex β 1 is determined based on the following formula, ,in, To determine the path of the light ray, the two-way scattering distribution function (BSDF) is sampled from the first vertex to the second vertex. P 1 is the probability density function PDF of sampling from the first vertex to the second vertex after the path of the ray has been determined. Before determining the path of the ray, the PDF sampled by the third vertex towards the second vertex, wherein the third vertex is the point in its neighborhood that originally illuminated the second vertex before determining the path of the ray. The weights for importance resampling.

[0015] Based on the above technical solution, once the second vertex is determined through importance resampling, that is, after the ray tracing path changes, the reflectivity of the first vertex can be adjusted to ensure the accuracy of the calculation of the reflected light from the first vertex.

[0016] In conjunction with the first aspect, in some embodiments of the first aspect, the illumination intensity of the first vertex is the illumination intensity obtained by reflecting the illumination intensity of the second vertex back to the first vertex, wherein the illumination intensity of the second vertex includes: the illumination intensity obtained by the second vertex through direct illumination and the illumination intensity obtained by the second vertex through indirect illumination.

[0017] In conjunction with the first aspect, in some embodiments of the first aspect, the illumination intensity I of the first vertex is determined based on the following formula, I = + ,in, After determining the path of the light ray, the second vertex samples the BSDF from the light source; After determining the path of the light ray, the second vertex samples the PDF from the light source; Before determining the path of the ray, the second vertex samples the PDF from the light source; After determining the path of the light ray, a BSDF is sampled from the second vertex in the direction of the indirect light. After determining the path of the light ray, the PDF sampled by the second vertex in the direction of the indirect light; Before determining the path of the ray, the PDF sampled by the second vertex in the direction of the indirect light; The intensity of the direct light illuminating the second vertex; The intensity of the indirect light at the second vertex.

[0018] Based on the above technical solution, in this application, once the second vertex is determined through importance resampling, that is, after the ray tracing path changes, the reflectivity of the second vertex can be adjusted, thereby ensuring the accuracy of the light intensity calculation of the first vertex and improving the sampling convergence speed.

[0019] In conjunction with the first aspect, in some embodiments of the first aspect, if the second vertex is a self-illuminating body or a light source, the illumination intensity of the first vertex further includes: The The light intensity of a self-luminous body or light source.

[0020] Based on the above technical solution, this application considers several possible compositions of the illumination intensity of the second vertex, thereby improving the accuracy of the calculation of the illumination intensity of the second vertex, and further improving the accuracy of the calculation of the illumination intensity of the first vertex.

[0021] In this application, after obtaining a sample through neighborhood importance resampling, this sample can be used as the second vertex of the current ray, thus changing the line path of the current ray. Therefore, it is necessary to recalculate the reflectivity and illumination intensity of the first vertex. Based on the above technical solution, the refractive index and illumination intensity of the first vertex can be recalculated and optimized, thereby improving the accuracy of the illumination intensity of the reflected light from the first vertex.

[0022] Secondly, a rendering apparatus is provided, comprising: a rendering thread unit and a resampling unit; the rendering thread unit is used to determine a first vertex where a ray intersects with an object; the resampling unit is used to determine a neighborhood of the ray, wherein the illumination distribution within the neighborhood is similar to the illumination distribution of the first vertex of the ray; the resampling unit is further used to determine the illumination distribution of incident light on the ray within the neighborhood, wherein the illumination distribution of the incident light is similar to the illumination distribution within the neighborhood; the resampling unit is used to determine a second vertex of the ray based on the illumination distribution of the incident light; and the rendering thread unit is further used to determine the path of the ray based on the first vertex and the second vertex.

[0023] In conjunction with the second aspect, in some embodiments of the second aspect, the resampling unit is used to determine the second vertex of the ray based on the illumination distribution of the incident light, including: the resampling unit is specifically used to perform importance resampling based on the illumination distribution function of the incident light of the ray in the neighborhood and the weight of the incident light of the ray in the neighborhood; through the importance resampling method, the resampling unit is used to obtain the second vertex of the ray.

[0024] In conjunction with the second aspect, in some embodiments of the second aspect, the apparatus further includes: a sample input unit and a reshaping unit, wherein the sample input unit is used to acquire the illumination parameters of the first vertex and the second vertex, the reshaping unit is used to determine the reflectivity of the first vertex and the illumination intensity of the first vertex based on the illumination parameters, and the reshaping unit is used to determine the illumination intensity of the reflected light from the first vertex based on the reflectivity of the first vertex and the illumination intensity.

[0025] In conjunction with the second aspect, in some embodiments of the second aspect, the reshaping unit is used to determine the reflectivity of the first vertex based on the following formula. β 1, ,in, To determine the path of the light ray, the two-way scattering distribution function (BSDF) is sampled from the first vertex to the second vertex. To determine the path of the ray, the probability density function PDF is sampled from the first vertex to the second vertex. Before determining the path of the ray, the PDF sampled by the third vertex towards the second vertex, wherein the third vertex is the point in its neighborhood that originally illuminated the second vertex before determining the path of the ray. The weights for importance resampling.

[0026] In conjunction with the second aspect, in some embodiments of the second aspect, the illumination intensity of the first vertex is the illumination intensity obtained by reflecting the illumination intensity of the second vertex back to the first vertex, wherein the illumination intensity of the second vertex includes: the illumination intensity obtained by the second vertex through direct illumination and the illumination intensity obtained by the second vertex through indirect illumination.

[0027] In conjunction with the second aspect, in some embodiments of the second aspect, the reshaping unit specifically determines the illumination intensity I of the first vertex based on the following formula, I = + ,in, After determining the path of the light ray, the second vertex samples the BSDF from the light source; After determining the path of the light ray, the second vertex samples the PDF from the light source; Before determining the path of the ray, the second vertex samples the PDF from the light source; After determining the path of the light ray, a BSDF is sampled from the second vertex in the direction of the indirect light. After determining the path of the light ray, the PDF sampled by the second vertex in the direction of the indirect light; Before determining the path of the ray, the PDF sampled by the second vertex in the direction of the indirect light; The intensity of direct light illuminating the second vertex; The intensity of the indirect light at the second vertex.

[0028] In conjunction with the second aspect, in some embodiments of the second aspect, if the second vertex is a self-illuminating body or a light source, the illumination intensity of the first vertex further includes: The The light intensity of a self-luminous body or light source.

[0029] In conjunction with the second aspect, in some embodiments of the second aspect, the illumination parameters include: the direction of incident light at the first vertex and the second vertex, the incident light intensity, the sampled BSDF, and the sampled PDF.

[0030] Thirdly, a graphics rendering apparatus is provided, the apparatus including at least one processor for executing a computer program stored in a memory, such that the apparatus implements the method in any possible implementation of the first aspect.

[0031] Optionally, the device may also include a memory, the processor being used to read instructions stored in the memory, and to receive signals via a receiver and transmit signals via a transmitter to execute the method in any of the possible implementations of the first aspect.

[0032] Optionally, the processor may be one or more, and the memory may be one or more.

[0033] Optionally, the memory may be integrated with the processor, or the memory may be separated from the processor.

[0034] In the specific implementation process, the memory can be a non-transitory memory, such as read-only memory (ROM), which can be integrated with the processor on the same chip or set on different chips. The embodiments of this application do not limit the type of memory or the way the memory and processor are set.

[0035] It should be understood that the relevant data interaction process, such as sending indication information, can be the process of outputting indication information from the processor, and receiving capability information can be the process of the processor receiving input capability information. Specifically, the processed output data can be output to the transmitter, and the input data received by the processor can come from the receiver. Here, the transmitter and receiver can be collectively referred to as a transceiver.

[0036] The device in the third aspect mentioned above can be a chip. The processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. The memory can be integrated into the processor or located outside the processor and exist independently.

[0037] Fourthly, a computer program product is provided, the computer program product comprising: a computer program (also referred to as code or instructions), which, when the computer program is run, causes a computer to perform the method in any of the possible implementations of the first aspect above.

[0038] Fifthly, a computer-readable medium is provided that stores a computer program (also referred to as code or instructions) that, when run on a computer, causes the computer to perform the methods in any of the possible implementations of the first aspect described above.

[0039] In a sixth aspect, a chip system is provided, including a processor for calling and running a computer program from a memory, such that a device equipped with the chip system performs the method in any possible implementation of the first aspect described above. Attached Figure Description

[0040] Figure 1 This is the system architecture diagram applicable to this application.

[0041] Figure 2 This is a schematic diagram of a path tracing algorithm.

[0042] Figure 3 This is a schematic flowchart of the graphics rendering method 300 provided in this application.

[0043] Figure 4 This is a schematic diagram of the two sampling stages of this application.

[0044] Figure 5 This is a schematic flowchart of the graphics rendering method of this application.

[0045] Figure 6 This is a schematic flowchart of the path sampling process in this application.

[0046] Figure 7 This is a schematic diagram illustrating the determination of neighborhood rays in this application.

[0047] Figure 8 This is a schematic diagram of the samples obtained after importance resampling in this application.

[0048] Figure 9 This is a schematic diagram illustrating the determination of sample occlusion relationships in this application.

[0049] Figure 10 This is a schematic diagram of the recoloring process in this application.

[0050] Figure 11 This is a schematic diagram of the structure of the rendering device 1100 in this application.

[0051] Figure 12 This is a schematic diagram of the structure of the rendering device 1200 in this application. Detailed Implementation

[0052] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0053] Figure 1 This is the system architecture diagram applicable to this application, such as... Figure 1 As shown, the architecture includes: 3D scene 101, 2D image 102, view camera 103, light 104, material 105, sampler 106, renderer 107, and accelerator 108.

[0054] This application can be applied to 3D rendering engines, whose main function is to render 3D scene models into 2D images. For example, Figure 1 The 3D scene 101 in the image can be rendered into a 2D image 102 by renderer 107. 3D rendering is a core model for applications such as games, film and television, interior design, architectural design, and industrial design. Typically, designers will design a 3D model (e.g., 101), design lighting (e.g., 104), materials (e.g., 105), and specify a camera viewpoint (e.g., 103) according to requirements. Then, the part seen from the camera viewpoint can be rendered into a 2D image (e.g., 102) through a rendering algorithm (e.g., 107). Figure 1 The architecture may also include a sampler 106 and an accelerator 108. The sampler 106 can provide sampled random numbers for the ray tracing engine, and the accelerator 108 can accelerate the performance of intersecting rays with the 3D scene.

[0055] To facilitate understanding of the technical solution of this application, a brief introduction to the technical terms involved in this application will be given first.

[0056] Rendering: The process of projecting a model in a 3D scene into a 2D digital graphic according to predefined environment, lighting, materials, and rendering parameters. Rendering uses computer calculations to present the model from a 3D model as a 2D photorealistic image. The calculation process includes a combination of variables such as lighting and auxiliary lighting, material textures and materials, and camera settings.

[0057] Importance sampling (IS) is a method used in statistics to estimate the properties of a distribution. This method samples from a different distribution than the original distribution and estimates the properties of the original distribution. In other words, sampling should be done according to "importance," not "equal treatment." If the sampling is done correctly, it may be possible to obtain an integral with very small error by performing only a small number of samples (calculating function values ​​at a few points).

[0058] Resampled importance sampling (RIS) is a sampling method that resamples samples that follow a known distribution to obtain samples that follow a different distribution. RIS is a method based on importance sampling that obtains samples that conform to a target distribution by resampling candidate samples with different weights. It can also be understood as sampling from a distribution that is different from the target distribution but easier to sample (which can be called a "proposed distribution" or "guiding distribution"), and then resampling from these samples with certain weights to obtain samples that approximately conform to the target distribution. RIS uses the ratio of the target distribution to the proposed distribution at the candidate sample points as the resampling weight, which measures the degree of approximation between the two distributions. Typically, the proposed distribution should be as close as possible to the target distribution.

[0059] Ray tracing is a type of rendering algorithm in computer graphics that simulates the propagation of light rays through reflection and refraction in a scene to render a 3D scene model into a 2D image. For example, it presents a 3D scene on a 2D visualized image. The basic principle of ray tracing is: Rays are emitted from the viewpoint towards pixels on the image plane, and the intersection point of the ray with the nearest object is found. If the surface at that point is a scattering surface, the color produced by the light source directly illuminating that point is calculated; if the surface at that point is a specular or refracting surface, another ray is traced in the direction of reflection or refraction, and this process is recursively repeated until the ray escapes the scene or the set maximum recursion depth (or the set maximum number of repetitions) is reached.

[0060] Path tracing: A type of ray tracing algorithm. Path tracing refers to tracing the propagation path of light rays starting from the camera to estimate the illumination value entering the camera, thereby rendering a 3D scene model into a 2D image. The basic principle of path tracing is: a ray is emitted from the viewpoint. When the ray intersects the surface of an object, a direction is sampled based on the material properties of the object's surface, and another ray is emitted. This process is iterated until the ray hits the light source (or escapes from the scene). Then, the illumination contribution is calculated using the Monte Carlo method (the Monte Carlo method uses a large number of random samples to understand a system and obtain the parameters to be calculated), which is then used as the color value of the pixel.

[0061] Direct illumination: When a light source directly shines on an object (taking object A as an example), the reflected light (including diffuse reflection and specular reflection) is called "direct illumination".

[0062] Indirect lighting: Reflected light produced when an object is illuminated by a non-light source can be understood as "indirect lighting". For example, light that is illuminated by a light source (taking object A as an example), reflected from object A to object B, and then reflected from object B into the camera (which can also be understood as "human eye") is called indirect lighting.

[0063] Reshaping: When the path of light changes, the reflectivity and light intensity of a certain point on an object change, and the light intensity of the reflected light needs to be recalculated. This is called "reshaping".

[0064] The bidirectional scattering distribution function (BSDF) quantifies the scattering phenomenon that occurs when an incident ray strikes a surface with uneven, minute surfaces. The term "bidirectional" refers to the directions of the incident and scattered light; different incident angles result in different scattering properties.

[0065] In this application, the BSDF of a vertex is an inherent property of the material, and its value is related to the direction of the sampled incident light at that vertex, the position of the vertex, and the direction of the reflected light at that vertex. For example, if the direction of the sampled incident light changes, the value of the BSDF of that vertex also changes.

[0066] Similarly, the probability density function (PDF) for sampling a vertex depends on the direction of the incident light sampled at that vertex, the vertex's position, and the direction of the reflected light. For example, if the direction of the incident light sampled changes, the PDF for that vertex needs to be recalculated.

[0067] The following is combined with Figure 2 Here's a brief overview of the sampling process using the path tracing algorithm: The first step involves providing a multidimensional random array or multidimensional sequence array for use in multi-sample screen-space sampling and multi-vertex path sampling. Each element of this multidimensional array can be an uncorrelated pseudo-random number. However, the sampling effect of uncorrelated pseudo-random numbers is not as good as that of carefully designed multidimensional sequence numbers. Typically, SOBOL sequences or low-discrepancy sequences of screen-space samples processed with blue noise can be used as random numbers. The second step involves determining the direction of a ray originating from the camera using screen-space random numbers and pixel positions; this ray is called the principal ray (e.g., ...). Figure 2The principal ray (#1) intersects with an object in the scene. This intersection point is the first vertex of the principal ray path (e.g., camera → P1 is the principal ray path, or, as can be understood, the first path). Figure 2 (P1 in the diagram). At this point, starting from the first vertex, a shadow ray is emitted towards the light source (e.g., ...). Figure 2 In the ray #2, the path with one vertex (or 1 vertex) is constructed, and its lighting contribution is estimated. If there is no occlusion between the vertex and the light source, the illumination from the light source to this vertex can be estimated. The third step involves constructing a path with two vertices (or 2 vertices), which can reuse the ray path with one vertex (e.g., ray #2). Figure 2 In the case of ray #1), specifically, a sample ray can be emitted from the first vertex (e.g., P1) as the starting point. Figure 2 The ray #3 continues to search for the next intersection point with the scene, serving as the vertex of the second path of the ray path (e.g., P1→P2 is the second path). Figure 2 (P2 in the middle), and then emit shadow rays (e.g., Figure 2 If ray #4 is unobstructed, its contribution to illumination can be estimated. A similar method can be used to construct a series of ray paths with 3, 4, 5, etc., vertices. The more paths constructed or the longer the paths, the higher the computational cost, but the more accurate the estimation. The Russian roulette wheel method can be used to terminate ray path construction and achieve unbiased estimation. Generally, in path tracing, the determination of the sampling direction has a significant impact on the estimation variance. Therefore, choosing a reasonable sampling direction will accelerate the convergence speed of path tracing.

[0068] As can be seen from the path sampling principle described above, the lighting estimate for each pixel is the sum of the lighting estimates for the first path (which can also be understood as a path of length 1) to an infinite number of paths. The lighting estimate for the first path (e.g., camera → P1 → light source) is the light intensity reflected from the direct light of the first vertex to the camera; the lighting estimate for the second path (camera → P1 → P2 → light source) is the light intensity reflected from the direct light of the second vertex to the first vertex, and then from the first vertex to the camera.

[0069] It should be noted that, for ease of understanding, the description of the path of light in this application may involve two different perspectives: one is the path from the light source to the camera (eye), which is the actual path of the light; the other is the angle of ray tracing, which can also be understood as the path of light sampling, i.e., the direction from the camera (eye) to the light source.

[0070] Currently, path tracing algorithms typically pre-define an importance sampling function based on the object's material properties (e.g., reflectivity) to determine the sampling weight for the incident direction given the light's outgoing direction. While this approach is more effective at finding efficient light paths than random, uniform sampling, the illumination contribution value depends not only on the material but also on the lighting distribution within the scene. If the incident direction, where the object's surface has high reflectivity, happens to be relatively dark, this importance sampling method will be inefficient.

[0071] In view of this, this application provides a graphics rendering method, apparatus and system that determines the path of light rays based on the illumination distribution in the effective neighborhood, thereby making the obtained path more efficient and saving computational costs.

[0072] Figure 3 This is a flowchart of the graphics rendering method 300 of this application. The following is in conjunction with... Figure 3 The graphic rendering method of this application is described.

[0073] Step 301: Determine the first vertex where the light ray intersects the object.

[0074] For example, in this application, the renderer can determine the first vertex (e.g., P1) where the ray intersects the object. The initial direction of the ray can be preset.

[0075] Step 302: Determine the neighborhood of the ray, wherein the illumination distribution within the neighborhood is similar to the illumination distribution at the first vertex of the ray.

[0076] For example, in this application, the renderer can determine the neighborhood of the light rays.

[0077] In this application, "neighborhood" can refer to a pixel region of a graphic with radius R, which can be preset. The illumination distribution of this neighborhood with radius R is similar to the illumination distribution of the path vertices. In other words, the scene illumination distribution within the effective neighborhood is similar to the illumination distribution of the path vertices. In a single sampling, the illumination distribution of the current path vertex can be better estimated through the illumination distribution of the effective neighborhood.

[0078] Step 303: Determine the illumination distribution of the incident light in the neighborhood, wherein the illumination distribution of the incident light is similar to the illumination distribution in the neighborhood.

[0079] For example, in this application, the renderer can determine the illumination distribution of incident light within a neighborhood.

[0080] Step 304: Determine the second vertex of the ray based on the illumination distribution of the incident light.

[0081] For example, in this application, the renderer can determine the second vertex of the ray (e.g., P2) based on the illumination distribution of the incident light.

[0082] As an example, the renderer can perform importance resampling based on the illumination distribution function of the incident light of the light rays in the neighborhood and the weights of the incident light of the light rays in the neighborhood, and obtain the second vertex of the light ray through the importance resampling method.

[0083] Step 305: Determine the path of the light ray based on the first vertex and the second vertex.

[0084] For example, in this application, the renderer can determine the ray tracing path based on the first vertex and the second vertex as: camera → P1 → P2 → light source.

[0085] It should be understood that in this application, the direction of ray path tracing is exactly opposite to the direction in which the human eye sees an object in a real scene.

[0086] According to the graphics rendering method provided in this application, the renderer can determine the path of light rays based on the illumination distribution within the effective neighborhood. Compared with the prior art, which only considers the material properties of objects when determining the light ray path, the technical solution of this application fully considers the influence of material properties and illumination distribution, thereby making the obtained ray tracing path more efficient, improving the sampling convergence speed, and saving computational costs.

[0087] To better implement the technical solution of this application, as an example, each sampling in this application can be divided into two stages of sampling, such as... Figure 4 As shown. For example, the two-stage sampling includes path sampling and neighborhood importance resampling. That is, each sampling will first perform path sampling (i.e., the first stage sampling), and then perform neighborhood importance resampling (i.e., the second stage sampling). In this application, path sampling can be used to obtain the lighting parameters of each vertex in the 3D scene, such as the direction of incident light, incident light intensity, and bidirectional scattering distribution function of each vertex; in this application, the above lighting parameters can be used to recolor the first vertex, that is, to calculate the reflectivity and light intensity of the first vertex. It should be noted that in this application, the path sampling of each pixel is independent of each other and can be executed concurrently. The neighborhood importance resampling of each pixel is also independent of each other and can be executed concurrently. Typically, the time consumed by neighborhood importance resampling is only about 1 / 5 of the path sampling time. Of course, this application is not limited to using only the path sampling method to obtain the above lighting samples, and the above lighting parameters can also be obtained through other means.

[0088] Figure 5 This is a flowchart of the graphics rendering method 500 of this application. The following is in conjunction with... Figure 5 The graphic rendering method of this application is described.

[0089] Step 501: Use the path tracing method to sample the ray path.

[0090] In this application, the purpose of this step is to obtain the data needed for neighborhood importance resampling. For example, more information about the illumination distribution of the current path vertices can be obtained from the data obtained from path sampling. Step 501 can be understood as... Figure 4 The first stage of sampling.

[0091] In this application, this step may, for example, be performed by a rendering thread unit in the renderer.

[0092] Step 502: Determine the effective neighborhood.

[0093] In this application, the purpose of this step is to determine a suitable-sized neighborhood (e.g., a pixel region of radius R) of the current path vertex in the 3D scene, such that the lighting distribution of this neighborhood is similar to the lighting distribution of the first vertex of the ray. Subsequently, the second vertex of the ray can be determined by the lighting distribution within the effective neighborhood.

[0094] In this application, this step can be performed, for example, by a resampling unit in a renderer.

[0095] Step 503: Resample the light rays in the neighborhood based on their importance.

[0096] First, the incident rays in the neighborhood can be resampled to obtain ray samples that are positively correlated with the current path vertex illumination contribution distribution. Then, importance sampling can be performed, which can accelerate the convergence speed of path tracing.

[0097] According to resampling theory, M origins from the distribution function are... p (X) (distribution function) p (X) can be understood as the aforementioned "proposed distribution" and "guided distribution" samples, if each sample is weighted If the samples are resampled according to this weight, the distribution function of the resulting samples will be similar to the target distribution function. g (X) Approximate. The weight of the resampling here is exactly the illumination contribution value of the incident light. For example, resampling can be performed using the inversion method, or other sampling methods can be used to obtain samples.

[0098] In this application, this step may, for example, be performed by a rendering thread unit in the renderer.

[0099] Step 504: Determine the occlusion relationship.

[0100] Importance resampling involves obtaining a ray sample from the incident rays in the neighborhood. However, the occlusion relationship between a resampled incident ray and the current path vertex may change. That is, a certain incident ray in the neighborhood may not be able to illuminate the current path vertex, meaning it is "occluded." In this case, the ray cannot be used as the resampled ray to estimate the illumination of the current path vertex; instead, the ray obtained from the path tracing algorithm can be used to estimate the illumination value.

[0101] In this application, this step can be performed, for example, by a reshaping unit in a renderer.

[0102] Step 505, recoloring the light.

[0103] If an unobstructed incident ray is found in the neighborhood, this ray can be used to recolor the current path vertex. In other words, this application can use the incident ray obtained from the neighborhood to redetermine the second vertex for the current path tracing. In other words, after neighborhood importance sampling, if an unobstructed incident ray can be obtained, the ray path can change during the current path tracing process. For example, according to current path tracing algorithms, assuming the ray path is: Camera → P1 → P2 → Light Source, according to the technical method provided in this application, if an unobstructed incident ray can be obtained in the neighborhood sampling, the intersection point of this ray with an object in the scene can be determined. If this intersection point is P2', then P2' is determined as the second vertex of the current path, and the ray path becomes: Camera → P1 → P2' → Light Source.

[0104] Because the path of the light ray has changed, that is, the first vertex of the current path (with...) Figure 1 Taking P1 as an example, the direction of the incident light also changes (the direction of the incident light at P1 changes from P2→P1 to P2´→P1). The recoloring process involves recalculating the illumination intensity of the reflected light at point P1. At this time, it is necessary to recalculate the reflectivity and illumination intensity of point P1. This will be explained in detail later with reference to the attached diagram.

[0105] In this application, this step can be performed, for example, by a reshaping unit in a renderer.

[0106] In this application, steps 502 to 505 can be understood as... Figure 4 The second stage of sampling.

[0107] The following section details the graphic rendering method of this application. First, combining... Figure 6 This section introduces the process of path sampling (which can also be understood as the first stage).

[0108] Figure 6This is a flowchart of the path sampling method 600 of this application. This application uses a path tracing algorithm as an example for illustration; that is, a path tracing algorithm is used for path sampling. Figure 6 As shown, in step 601, each pixel emits a path ray from the camera; in step 602, it is determined whether there is an intersection point with scene objects: if there is no intersection, the current path sampling ends; if there is an intersection, step 603 is continued to generate path vertices and obtain material reflection-related parameters (e.g., incident direction, incident light intensity, sampled BSDF, sampled PDF, etc.). These reflection parameters can be used to calculate the first vertex of the current path during the reshaping process of path sampling (e.g., Figure 1 Step 604: Light source sampling, i.e., emitting shadow rays in the direction of the light source and estimating the illumination intensity from the light source to this vertex, thus forming a complete path. Step 605: Reusing this path vertex, the importance sampling function is used to determine the direction of the next vertex, and rays are emitted to continue the intersection judgment.

[0109] In order to perform subsequent neighborhood importance sampling, after step 604 and before step 605, that is, after the light source sampling and before determining the direction of the next vertex, step 606 must be executed, that is, to determine whether it is the first vertex of the path (e.g., Figure 1 If P1 is the first vertex of the path, or if it is the second vertex, then proceed to step 607 to save the positions, incident directions, incident light intensity, BSDF, and other information of the first and second path vertices. This is because, in the subsequent recoloring process of neighborhood sampling, the parameter information saved in this step can be directly used to quickly and effectively recalculate the reflectivity and illumination intensity of the first vertex, thereby obtaining the illumination intensity of the reflected light from the first vertex (i.e., recoloring the first vertex).

[0110] The process of neighborhood sampling is described below. Please refer to [link to relevant documentation]. Figure 5 Steps 502 to 505 in the process.

[0111] As mentioned earlier, not all ray paths require neighborhood importance sampling. For example, if the ray path does not intersect with the scene, neighborhood importance sampling is not performed; if the first vertex (e.g., Figure 1 P1 in the model is either specular reflection or glossy reflection with a smooth surface. Since the directional range after reflection of such a path is narrow, there is no need to resample the neighborhood importance.

[0112] The first step is to determine the effective neighborhood and the light rays within that neighborhood.

[0113] First, a pixel region with radius R (the value of R can be preset) can be defined as a neighborhood, such that the lighting distribution within this neighborhood is similar to the first vertex of the ray path (where R is a pixel region with radius R). Figure 1 Taking P1 as an example, the lighting distribution is similar. Specifically, if the first vertex of a ray within the neighborhood is not far from the first vertex of the current path and their normals are in the same direction (meaning the direction of the normal to the plane containing the first vertex of the neighborhood ray is the same as the direction of the normal to the plane containing P1), it can be considered a ray within the effective neighborhood. If the first vertex of a ray within the neighborhood is far from P1 or its normal is in a different direction, it can be determined that the lighting conditions of this ray differ significantly from those of the current principal ray in the scene, and therefore it is not considered a ray within the effective neighborhood, i.e., it is not used as a sample to determine the lighting contribution value. The more rays within the effective neighborhood that can provide information about the lighting contribution value, the closer the lighting distribution in that neighborhood is to the true lighting contribution distribution, and the better the effect of subsequent neighborhood importance resampling.

[0114] like Figure 7 As shown, a preset ray #1 originates from the camera, and the intersection point of ray #1 and an object in the scene is denoted as P1. #1 (That is, the first vertex of the current path is P1) #1 Let the pixel region of radius R be the neighborhood of ray #1. Assume that its neighborhood contains rays #a, #b, #c, and #d. Figure 7 As shown, ray #a in the neighborhood intersects with an object in the scene at point P1. #a Point, vertex P1 #a The normal to the plane in question is horizontal to the right; the ray #b in the neighborhood intersects with objects in the scene at point P1. #b Point, vertex P1 #a The normal to the plane is horizontal and upward. Similarly, the ray #c in the neighborhood intersects with objects in the scene at point P1. #c Point, vertex P1 #c The normal to the plane is also horizontal and pointing upwards. The ray #d in the neighborhood intersects with objects in the scene at P1. #d Point, vertex P1 #d The normal to the plane it lies in is also horizontal and upward, but as shown in the figure, vertex P1 #d With the first vertex P1 #1 They are quite far apart. At this time, due to the first vertex P1 of ray #a in the neighborhood of ray #1... #a And the first vertex P1 of ray #1 #1 The vertices are far apart or have different normal orientations, and the first vertex P1 of ray #d. #d And the first vertex P1 of ray #1 #1Since they are far apart, the lighting conditions of rays #a and #d in the scene are quite different from those of ray #1, so they are not used as samples for judging the lighting contribution value in the neighborhood.

[0115] The second step is to resample the light rays in the neighborhood based on their importance.

[0116] Once the neighborhood to be resampled and the individual rays in the neighborhood that can be resampled based on importance (for example, in the first step, the rays that can be resampled based on importance in the neighborhood are ray #b and ray #c) are determined, importance resampling can be performed.

[0117] The following describes the importance resampling of samples of determined neighborhood light rays.

[0118] As mentioned earlier, according to resampling theory, M origins from the distribution function are... p (X) (distribution function) p (X) can be understood as the aforementioned "proposal distribution" and "guiding distribution" samples, if each sample is assigned a weight. If the samples are resampled according to this weight, the distribution function of the resulting samples will be similar to the target distribution function. g (X) approximate.

[0119] In this step, for example, the indirect light from the first vertex of ray #c in the neighborhood can be considered as originating from the distribution function. p (X) samples. To obtain samples similar to the overall illumination contribution of the neighborhood, each ray in the neighborhood can be reweighted, with the weights... It is exactly the illumination contribution weight of the indirect light at the first vertex of each ray in the neighborhood.

[0120] in, g ( X i This can be understood as the illumination distribution function of incident light within the neighborhood; p ( X i () is the PDF sampled from the first vertex to the second vertex of the ray in the neighborhood; f i Let P1 be the reflectivity of the first vertex of the ray in the neighborhood, for example, vertex P1. #b Reflectivity; L i Let P1 be the intensity of the incident light in the neighborhood, for example, at vertex P1. #b The intensity of the incident light. That is, by calculating... This allows us to obtain the light intensity from the light source within the neighborhood to the camera (or human eye). Sample the PDF from the first vertex of the ray in the neighborhood to the light source.p ( X i The distribution function is related to the material of the object; different materials have different distribution functions. p ( X i The distribution function is different; it can also be understood that once the material of an object is determined, its... p ( X i The distribution function is also determined.

[0121] Continue to refer to Figure 7 Taking neighborhood ray #b as an example, neighborhood ray #b can be used as a resampled neighborhood ray, and the intersection of neighborhood ray #b and the scene is vertex P1. #b One of the rays, #S, is incident on P1. #b P1 #b The illumination intensity at a point is related to the illumination intensity of the incident light ray #S, which can be understood as P1. #b Indirect light from a point. The weights calculated above. I i This can be understood as the incident ray #S versus P1. #b The contribution weight of point illumination intensity.

[0122] Importance sampling based on this weight can make the illumination distribution of indirect light for each ray in the neighborhood (e.g., ray #c) basically similar to the illumination distribution of the actual incident light in the neighborhood.

[0123] Determine the weight of each ray in the neighborhood. Then, the direction of the incident light at the first vertex of the ray within the neighborhood is obtained. For example, resampling can be performed using the inverse transform method. Inverse transform sampling requires weight normalization, which can be achieved by first normalizing the weights, i.e., , , Then, the normalized weights are summed to obtain the cumulative distribution function (CDF) of the ray #c, that is, Then find the inverse function of CDF. ,because The value of is between [0,1], so random numbers can be used. To obtain the sampled sample, i.e. Here are the samples That is, the intersection point of the direction of the indirect light from the first vertex of the ray within the neighborhood and the object.

[0124] Reference Figure 8 Assume the sample obtained after the inverse transformation is For P2 #cThis indicates that the signal is directed to P1. #1 →P2 #c Directional sampling is more efficient, meaning the ray tracing path is more efficient. Neighborhood resampling allows for the sampling of ray directions between neighboring rays. You can randomly obtain a sample. X s This indicates that for ray #1, towards the vertex X s Directional sampling is more effective in finding illumination; that is, for ray #1, directional sampling towards P1... #1 → X s Directional path tracking is more efficient.

[0125] As described above, in this step, the vertex where the first vertex of the resampled neighborhood ray intersects with the object (e.g., P2) is... #c In other words, the incident direction of light within the neighborhood is obtained. This direction comprehensively considers the current location's illumination distribution information and the material's reflection characteristics, making it more optimized and effective than the original path tracing algorithm's sampling method that only considers the material. Furthermore, the illumination parameters used for neighborhood resampling are obtained in advance, reducing computational costs beyond resampling operations.

[0126] The third step is to determine the occlusion relationship.

[0127] After resampling to obtain samples (e.g., the obtained sample is P2) #b At this point, it is also necessary to determine whether the obtained sample matches the first vertex P1 of the current ray path. #1 Are there any occlusions between them? If a sample obtained in this neighborhood cannot illuminate the first vertex P1 of the current path. #1 In other words, the presence of occlusion indicates a difference between the actual illumination distribution of the incident light in the neighborhood and the illumination distribution along this incident direction. Therefore, the samples obtained from resampling cannot be used to estimate the first vertex P1 of the current path. #1 The light intensity can be estimated using the path tracing algorithm. #1 The intensity of light. For example, such as Figure 9 As shown, assume the sample obtained by resampling is P2. #b Because of P2 #b With the first vertex P1 on the current path #1 There is an object blocking the light, and the light source is from vertex P2. #b Unable to illuminate vertex P1 #1 At this point, the sample cannot be used to estimate the current path vertex P1. #1 The illumination. The path tracing algorithm can be used to estimate P1. #1 Light intensity.

[0128] Step 4: Recoloring the light.

[0129] If the resampled sample X s With the first vertex P1 on the current path #1 If there are no obstructions between the two points, this sample can be used as the second vertex of the current path. For easy distinction, it is denoted as "P". 2´ This can also be understood as the path tracing direction of ray #1 being P1. #1 → X s Or, to understand it as determining the second vertex of ray #1 based on the resampled sample, that is, using... X s As the second vertex of ray #1. Figure 10 As shown, P2 can be... #c The second vertex P of ray #1 is determined. 2´ .

[0130] At this point, because the path of ray #1 has changed, from the perspective of the actual illumination of the ray, for the first vertex P1 of the current path... #1 In this case, the direction of the incident light is P2 #c →P1, therefore, it is necessary to check the first vertex P1 of the current path. #1 Perform recoloring. The recoloring process can also be understood as: redefining P1 #1 Reflectivity and P1 #1 The light intensity, thus determining P1 #1 →Light intensity at the camera (human eye). This is because the second vertex P of ray #1... 2´ It is re-determined based on the resampled samples, therefore the first vertex P1 #1 Reflectivity and P1 #1 The light intensity will change, requiring recalculation. Conversely, from a ray tracing perspective, the direction of the sampled ray is from P1. #c →P2 #c Change to P1 #1 →P2 #c For the second vertex P2 #c (that is, P) 2´ Regarding the sampling incident light, the direction of the incident light has changed (the direction of the sampling incident light changes from P1). #c →P 2´ , changed to, P1 #1 →P 2´ Then P2 #c (that is, P) 2´ The reflectivity of P2 will also change, which can also be understood as...#c The BSDF and PDF have changed.

[0131] In this application, P1 #1 The reflectivity is related to the probability density function (PDF) of light hitting the second vertex. Specifically, P1 #1 Reflectivity and: Determining P 2´ Previously, the other first vertices in the neighborhood (the other first vertices in the neighborhood refer to those that determine P) 2´ Previously, P was irradiated 2´ Vertices, such as P1 #c ) Irradiated P 2´ PDF and determine P 2´ After that, P1 #1 Point irradiation to P 2´ PDF-related for points, assuming P1 is recalculated #1 If the reflectance is β1, then ,in, To change the path of the light rays, i.e., P1 #1 →P 2´ Sampled PDF, Before changing the light path, the original light rays illuminating P in the neighborhood... 2´ The vertex (e.g., other first vertices in the neighborhood, such as P1) #c ) to P 2´ The sampled PDF (which was previously saved during path sampling). To change the path of the light rays, i.e., P1 #1 →P 2´ Sampled BSDF, The weights for importance resampling. In this application, ,in, The BSDF sampled from the first vertex of the ray in the neighborhood towards the light source (e.g., vertex P2). #c (The BSDF was previously saved during path sampling). The illumination intensity of the first vertex of the ray within the neighborhood (e.g., vertex P2) #c (light intensity) PDF sampled from the first vertex of the ray in the neighborhood towards the light source (e.g., vertex P1) #c →P2 #c (Sampled PDF).

[0132] In this application, due to the change in the path of ray #1, P1 #1 Light intensity and P1 #1 PDF, BSDF and P 2´Related to PDF and BSDF. P1 #1 The light intensity at a point can be: P1 #1 Indirect lighting at a point, that is, P 2´ The light intensity reflected to P1 #1 The light intensity at a point, i.e., P 2´ →P1 #1 Light intensity may include the following situations: Scenario 1: The light source shines on P 2´ (It can also be understood as P) 2´ (direct light), P 2´ Illuminate the first vertex of the current path.

[0133] As an example, such as Figure 10 As shown, the actual path of the light ray is: light source → P 2´ →P1 #1 →Camera, conversely, the ray tracing path is: Camera → P1 #1 →P 2´ →Light source.

[0134] At this time, the light intensity I of P1 = + ,in, After changing the sampling ray path, i.e., resampling, the sample obtained is P. 2´ P 2´ → The sampling BSDF in the light source direction needs to be recalculated (i.e., the sampling BSDF in this direction needs to be recalculated because for P...) 2´ In other words, the direction of the incident light sampled is from P2 #c →P1 #1 It becomes: P1 #1 →P 2´ Therefore, P 2´ →The sampling BSDF in the direction of the light source will also change accordingly. After changing the sampling ray path, i.e., resampling, the sample obtained is P. 2´ P 2´ → PDF sampled in the direction of the light source (i.e., the PDF sampled in that direction needs to be recalculated; similarly, for P) 2´ In other words, the direction of the incident light sampled is from P2 #c →P1 #1 It becomes: P1 #1 →P 2´ Therefore, P 2´ →The sampled PDF will also change depending on the direction of the light source). Before changing the sampling ray path, P 2´ → PDF of light source direction sampling (previously saved during path sampling). The light intensity of the light source can also be understood as... The intensity of the direct light at the second vertex (which was previously saved during path sampling).

[0135] That is, after changing the sampling ray path, if P 2´ It is direct illumination (i.e., a light source can directly illuminate P). 2´ When calculating P, 2´ Reflected to P1 #1 When illuminating a point, P needs to be considered. 2´ The reflectivity changes (i.e., P) 2´ BSDF and PDF need optimization.

[0136] Scenario 2: P is illuminated by a non-light source. 2´ (It can also be understood as P) 2´ Indirect lighting at a point), P 2´ Illuminate the first vertex of the current path.

[0137] As an example, such as Figure 10 As shown, the actual path of the ray is: P3→P 2´ →P1 #1 →Camera, conversely, the ray tracing path is: Camera → P1 #1 →P 2´ →P3.

[0138] at this time, ,in, After changing the direction of the light path, i.e., the sample obtained by resampling is P. 2´ P 2´ →The BSDF sampled at P3 can also be understood as the BSDF sampled from the second vertex towards the indirect light direction; that is, the sample obtained by resampling after changing the direction of the light path is P. 2´ P 2´ → A PDF sampled using P3 technology can also be understood as... PDF sampled from the second vertex in the direction of indirect light; Before changing the path of light, P 2´ →The PDF sampled by P3 can also be understood as the PDF sampled by the second vertex in the direction of the indirect light before the ray path is changed (it was saved during the path sampling earlier). For P 2´ The intensity of indirect light at the point (previously saved during path sampling).

[0139] That is, after changing the sampling ray path, if P 2´ It is indirect lighting (i.e., non-light source illuminating P). 2´ When calculating P,2´ Reflected to P1 #1 When illuminating a point, P also needs to be considered. 2´ The reflectivity changes (i.e., P) 2´ BSDF and PDF need optimization.

[0140] Scenario 3: P 2´ It is itself a self-illuminating body or light source; the actual light path is: P 2´ Illuminate the first vertex of the current path, namely P. 2´ (Light source) → P1 #1 →Camera, I3= ,at this time Equivalent to, P 2´ Point illumination intensity (P) 2´ The point is a self-luminous light source.

[0141] As can be seen from the above, in this application, P 2´ →P1 #1 The light intensity I = I1 + I2 + I3. Therefore, P1 #1 Light intensity I 总 =I1+ I2+I3, then, P1 #1 →Light intensity of camera (human eye) = I 总 β 1 According to the method provided in this application, the method for determining the second vertex in current path tracing algorithms is optimized and improved through a neighborhood importance resampling method. Furthermore, this application determines the ray path based on the illumination distribution within the effective neighborhood, making the obtained ray tracing path more efficient, improving sampling convergence speed, and reducing computational costs.

[0142] Figure 11 This is a schematic diagram of the component structure of the rendering apparatus 1100 provided in this application. Figure 11 The main components include the following modules or units: The user interface (UI), modeling tools (e.g., blender), and render session management layer can be used to view various user requests and operations. The system also includes a path tracing central processing unit (PTCPU), a path tracing open computer language (PTCPU), bidirectional path tracing (BPT), a computer importance sampling (CIS) central processing unit (CPU), and a path tracer. The graphics rendering apparatus provided in this application further includes: The sampler unit (or module) 1101 is responsible for generating a sequence number for each pixel and each round of sampling, and for allocating sampling tasks.

[0143] The render thread unit 1102 is responsible for performing path sampling and neighborhood importance resampling tasks.

[0144] The sample entry unit 1103 is used to store intermediate results of path sampling, including direct illumination of the first and second vertices, BSDF, incident light intensity, etc.

[0145] The resampling unit 1104 is used to determine the neighborhood range, load neighborhood data, calculate weights, and complete sample resampling.

[0146] The reshading unit 1105 is used to determine occlusion relationships and recolor the first vertex.

[0147] Specifically, in some embodiments, the rendering thread unit is used to determine the first vertex where the ray intersects with the object; the resampling unit is used to determine the neighborhood of the ray, the illumination distribution within the neighborhood being similar to the illumination distribution of the first vertex of the ray; the resampling unit is also used to determine the illumination distribution of the incident light of the ray within the neighborhood, the illumination distribution of the incident light being similar to the illumination distribution within the neighborhood; the resampling unit is used to determine the second vertex of the ray based on the illumination distribution of the incident light; and the rendering thread unit is also used to determine the path of the ray based on the first vertex and the second vertex.

[0148] In one possible design, the resampling unit is used to determine the second vertex of the ray based on the illumination distribution of the incident light, including: the resampling unit is specifically used to perform importance resampling based on the illumination distribution function of the incident light of the ray in the neighborhood and the weight of the incident light of the ray in the neighborhood; through the importance resampling method, the resampling unit is used to obtain the second vertex of the ray.

[0149] In one possible design, the device further includes: a sample input unit and a reshaping unit, wherein the sample input unit is used to acquire the illumination parameters of the first vertex and the second vertex, the reshaping unit is used to determine the reflectivity and illumination intensity of the first vertex based on the illumination parameters, and the reshaping unit is used to determine the illumination intensity of the reflected light from the first vertex based on the reflectivity and illumination intensity of the first vertex.

[0150] In one possible design, the reshaping unit is specifically used to determine the reflectivity of the first vertex based on the following formula. β 1, ,in, To determine the path of the light ray, the two-way scattering distribution function (BSDF) is sampled from the first vertex to the second vertex. To determine the path of the ray, the probability density function PDF is sampled from the first vertex to the second vertex. Before determining the path of the ray, the PDF sampled by the third vertex towards the second vertex, wherein the third vertex is the point in its neighborhood that originally illuminated the second vertex before determining the path of the ray. The weights for importance resampling.

[0151] In one possible design, the reshaping unit is specifically used to determine the illumination intensity I of the first vertex based on the following formula, I = + ,in, After determining the path of the light ray, the second vertex samples the BSDF from the light source; After determining the path of the light ray, the second vertex samples the PDF from the light source; Before determining the path of the ray, the second vertex samples the PDF from the light source; After determining the path of the light ray, a BSDF is sampled from the second vertex in the direction of the indirect light. After determining the path of the light ray, the PDF sampled by the second vertex in the direction of the indirect light; Before determining the path of the ray, the PDF sampled by the second vertex in the direction of the indirect light; The intensity of the direct light illuminating the second vertex; The intensity of the indirect light at the second vertex.

[0152] The device 1100 can execute the steps corresponding to methods 300, 500, and 600 in the embodiments of this application. It should be understood that the specific process of each unit executing the above-mentioned corresponding steps has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.

[0153] Figure 12 This is a schematic block diagram of a rendering apparatus 1200 provided in an embodiment of this application. As shown, the apparatus 1200 includes at least one processor 1220. The processor 1220 is coupled to a memory and is used to execute instructions stored in the memory to send and / or receive signals. Optionally, the apparatus 1200 also includes a memory 1230 for storing instructions.

[0154] The processor and transceiver can correspond to Figure 11 Each unit in the process.

[0155] It should be understood that the processor 1220 and memory 1230 can be combined into a single processing device, with the processor 1220 executing the program code stored in the memory 1230 to achieve the aforementioned functions. In specific implementations, the memory 1230 can be integrated into the processor 1220 or independent of the processor 1220.

[0156] It should be understood that the specific process by which the processor performs the above-mentioned corresponding steps has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.

[0157] According to the method provided in the embodiments of this application, this application also provides a computer program product, which stores computer program code. When the computer program code is run on a computer, it causes the computer to execute the method of this embodiment, such as any one of method 300, method 500, and method 500.

[0158] According to the method provided in the embodiments of this application, this application also provides a computer-readable medium storing program code, which, when run on a computer, causes the computer to execute the method of this embodiment, such as any one of method 300, method 500, and method 600.

[0159] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software modules within the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0160] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method.

[0161] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous-link dynamic random access memory (SLDRAM), and direct memory bus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0162] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0163] In the above-described device embodiments, the network-side devices correspond to the terminal devices and the network-side devices or terminal devices in the method embodiments. Corresponding modules or units execute corresponding steps. For example, the communication unit (transceiver) executes the receiving or sending steps in the method embodiments, while other steps besides sending and receiving can be executed by the processing unit (processor). The specific functions of each unit can be found in the corresponding method embodiments. There can be one or more processors.

[0164] As used in this specification, the terms "component," "unit," "module," etc., are used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or a computer. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process and / or an execution thread, and components may be located on a single computer and / or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).

[0165] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

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

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

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

[0169] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0170] If the aforementioned functions are implemented as 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 this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0171] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A graphics rendering method, characterized in that, include: Determine the first vertex where the light ray intersects the object; Determine the neighborhood of the ray, wherein the illumination distribution within the neighborhood is similar to the illumination distribution at the first vertex of the ray; Determine the illumination distribution of the incident light within the neighborhood, wherein the illumination distribution of the incident light is similar to the illumination distribution within the neighborhood; Based on the illumination distribution of the incident light, importance resampling is performed to determine the second vertex of the light ray; Based on the first vertex and the second vertex, determine the path of the light ray; The method further includes: Obtain the lighting parameters of the first vertex and the second vertex; Based on the lighting parameters, the reflectivity of the first vertex and the lighting intensity of the first vertex are determined; Based on the reflectivity and illumination intensity of the first vertex, determine the illumination intensity of the reflected light from the first vertex; Wherein, the reflectivity of the first vertex is... , ,and + Related, the stated With the The above Inversely proportional, the To determine the path of the ray, the two-way scattering distribution function (BSDF) is sampled from the first vertex to the second vertex. The weights for importance sampling, To determine the path of the ray, the probability density function PDF is sampled from the first vertex to the second vertex. Before determining the path of the ray, the PDF sampled by the third vertex to the second vertex is obtained, wherein the third vertex is a point in the neighborhood that originally illuminated the second vertex before determining the path of the ray.

2. The method according to claim 1, characterized in that, The process of performing importance resampling based on the illumination distribution of the incident light to determine the second vertex of the light ray includes: Importance resampling is performed based on the illumination distribution function of the incident light within the neighborhood and the weights of the incident light within the neighborhood. The second vertex of the ray is obtained through the importance resampling.

3. The method according to claim 1 or 2, characterized in that, The reflectivity of the first vertex β 1 is determined based on the following formula: .

4. The method according to claim 1 or 2, characterized in that, The illumination intensity of the first vertex is the illumination intensity obtained by reflecting the illumination intensity of the second vertex back to the first vertex. The illumination intensity of the second vertex includes: the illumination intensity obtained by the second vertex through direct illumination and the illumination intensity obtained by the second vertex through indirect illumination.

5. The method according to claim 1 or 2, characterized in that, The illumination intensity I at the first vertex is determined based on the following formula: I= + , in, After determining the path of the light ray, the second vertex samples the BSDF from the light source; After determining the path of the light ray, the second vertex samples the PDF from the light source; Before determining the path of the ray, the second vertex samples the PDF from the light source; After determining the path of the light ray, a BSDF is sampled from the second vertex in the direction of the indirect light. After determining the path of the light ray, the PDF sampled by the second vertex in the direction of the indirect light; Before determining the path of the ray, the PDF sampled by the second vertex in the direction of the indirect light; The intensity of direct light illuminating the second vertex; The intensity of the indirect light at the second vertex.

6. The method according to claim 5, characterized in that, If the second vertex is a self-illuminating body or a light source, the illumination intensity of the first vertex also includes: The The light intensity of a self-luminous body or light source.

7. The method according to claim 1 or 2, characterized in that, The illumination parameters include: the direction of incident light at the first vertex and the second vertex, the incident light intensity, the sampled BSDF, and the sampled PDF.

8. A graphics rendering apparatus, characterized in that, The device includes: a rendering thread unit and a sampling unit. The rendering thread unit is used to determine the first vertex where the ray intersects with the object; The sampling unit is used to determine the neighborhood of the light ray, and the illumination distribution within the neighborhood is similar to the illumination distribution at the first vertex of the light ray; The sampling unit is also used to determine the illumination distribution of the incident light in the neighborhood, wherein the illumination distribution of the incident light is similar to the illumination distribution in the neighborhood; The sampling unit is used to perform importance resampling based on the illumination distribution of the incident light to determine the second vertex of the light ray; The rendering thread unit is also used to determine the path of the ray based on the first vertex and the second vertex; The device further includes: a sample input unit and a recoloring unit. The sample input unit acquires the lighting parameters of the first vertex and the second vertex; The reshaping unit is used to determine the reflectivity of the first vertex and the illumination intensity of the first vertex based on the illumination parameters; The reshaping unit is used to determine the illumination intensity of the reflected light from the first vertex based on the reflectivity and illumination intensity of the first vertex. Wherein, the reflectivity of the first vertex is... , ,and + Related, the stated With the The above Inversely proportional, the To determine the path of the ray, the two-way scattering distribution function (BSDF) is sampled from the first vertex to the second vertex. The weights for importance resampling, To determine the path of the ray, the probability density function PDF is sampled from the first vertex to the second vertex. Before determining the path of the ray, the PDF sampled by the third vertex to the second vertex is obtained, wherein the third vertex is a point in the neighborhood that originally illuminated the second vertex before determining the path of the ray.

9. The apparatus according to claim 8, characterized in that, The sampling unit is a resampling unit, which is used to perform importance resampling based on the illumination distribution of the incident light to determine the second vertex of the ray. Specifically, the resampling unit is used to perform importance resampling based on the illumination distribution function of the incident light of the ray in the neighborhood and the weight of the incident light of the ray in the neighborhood. Through the importance resampling, the resampling unit is used to obtain the second vertex of the ray.

10. The apparatus according to claim 8 or 9, characterized in that, The recoloring unit is specifically used to determine the reflectivity of the first vertex based on the following formula. β 1: .

11. The apparatus according to claim 8 or 9, characterized in that, The illumination intensity of the first vertex is the illumination intensity obtained by reflecting the illumination intensity of the second vertex back to the first vertex. The illumination intensity of the second vertex includes: the illumination intensity obtained by the second vertex through direct illumination and the illumination intensity obtained by the second vertex through indirect illumination.

12. The apparatus according to claim 8 or 9, characterized in that, The reshaping unit is specifically used to determine the illumination intensity I of the first vertex based on the following formula. I= + , in, After determining the path of the light ray, the second vertex samples the BSDF from the light source; After determining the path of the light ray, the second vertex samples the PDF from the light source; Before determining the path of the ray, the second vertex samples the PDF from the light source; After determining the path of the light ray, a BSDF is sampled from the second vertex in the direction of the indirect light. After determining the path of the light ray, the PDF sampled by the second vertex in the direction of the indirect light; Before determining the path of the ray, the PDF sampled by the second vertex in the direction of the indirect light; The intensity of direct light illuminating the second vertex; The intensity of the indirect light at the second vertex.

13. The apparatus according to claim 12, characterized in that, If the second vertex is a self-illuminating body or a light source, the illumination intensity of the first vertex also includes: The The light intensity of a self-luminous body or light source.

14. The apparatus according to claim 8 or 9, characterized in that, The illumination parameters include: the direction of incident light at the first vertex and the second vertex, the incident light intensity, the sampled BSDF, and the sampled PDF.

15. A rendering apparatus, characterized in that, The device includes at least one processor for executing a computer program stored in a memory, such that the device implements the method as described in any one of claims 1 to 7.