Light sampling method based on two-dimensional BSDF

Through the ray sampling method based on two-dimensional BSDF, uniform random sampling of spherical coordinate system and energy division is used to solve the problem of inefficient sampling efficiency of complex BSDF, and fast and accurate acquisition of ray data is achieved.

CN120446060BActive Publication Date: 2025-09-02CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510944281.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-09-02
Estimated Expiration
2045-07-09

AI Technical Summary

Technical Problem

The existing BSDF sampling method cannot directly perform ray sampling when facing complex patterns, and rejection of sampling algorithms can easily lead to repeated sampling and inefficient efficiency.

Method used

Using a two-dimensional BSDF-based light sampling method, by establishing a spherical coordinate system and dividing energy on the unit sphere, uniform random sampling is performed using the two-dimensional joint distribution of scattered energy to obtain the position and direction of the emitted light.

Benefits of technology

It realizes efficient sampling of complex BSDF, avoids repeated sampling problems, improves sampling speed and accuracy, and is suitable for large-scale light analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120446060B_ABST
    Figure CN120446060B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of non-sequential ray tracing, and in particular relates to a light sampling method based on a two-dimensional BSDF. The method comprises: S1: establishing a spherical coordinate system based on the incident light of the optical surface, and dividing the energy at the angle on the unit sphere to obtain a two-dimensional joint distribution of the scattered energy; S2: using the two-dimensional joint distribution of the scattered energy to sample each sub-region, and obtain the zenith angle subscript and azimuth angle subscript of the sub-region where the outgoing light is located; S3: uniformly and randomly sampling the zenith angle and azimuth angle inside the sub-region where the sampled outgoing light is located, and obtaining the position and outgoing direction of the outgoing light; S4: repeating steps S1-S3 until the position and outgoing direction of all outgoing light rays are calculated based on all the incident light rays incident on the optical surface, and the light sampling is completed. The present invention does not have the problem of repeated sampling in the rejection sampling algorithm, and has a high sampling efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of non-sequential ray tracing, and in particular relates to a ray sampling method based on two-dimensional BSDF. Background Art

[0002] Optical surfaces often have a certain degree of roughness due to imperfect machining and other factors. When light passes through these surfaces, it is often scattered, producing light that does not conform to Snell's law. This light is known as stray light in optical systems. The Bidirectional Scattering Distribution Function (BSDF) can quantitatively describe the scattering characteristics of light and is therefore widely used in fields such as stray radiation analysis and computer vision.

[0003] Currently, when using BSDFs for Monte Carlo ray tracing of optically scattering surfaces, converting the BSDF distribution of the optically scattering surface into a ray distribution is a critical issue. Practical analysis often requires numerous ray tracing runs to achieve high robustness. However, the complexity of some commonly used BSDF structures can make direct ray sampling impossible. Therefore, developing a universal BSDF-based sampling method is crucial.

[0004] Currently, mainstream sampling methods include rejection sampling and inverse transform algorithms. The inverse transform algorithm fails when encountering complex BSDFs because it cannot find the inverse function. The rejection sampling algorithm, on the other hand, often suffers from repeated sampling when the function has large peaks and valleys, leading to low sampling efficiency. Summary of the Invention

[0005] In view of this, the present invention aims to provide a light sampling method based on two-dimensional BSDF to solve the problem that the structural type of existing BSDF is often highly complex, resulting in the inability to directly perform light sampling. The present invention samples complex BSDFs. During each sampling, four random numbers are generated by a computer to complete the sampling of two angle values. There is no problem of repeated sampling in the rejection sampling algorithm, so it has higher efficiency.

[0006] To achieve the above object, the technical solution created by the present invention is implemented as follows:

[0007] A light sampling method based on a two-dimensional BSDF comprises the following steps:

[0008] S1: A spherical coordinate system is established based on the incident light on the optical surface, and the energy is divided at the angle of the unit sphere to obtain the two-dimensional joint distribution of the scattered energy;

[0009] S2: Sample each sub-region using the two-dimensional joint distribution of scattered energy to obtain the zenith angle subscript and azimuth angle subscript of the sub-region where the outgoing light is located;

[0010] S3: uniformly and randomly sample the zenith angle and azimuth angle within the sub-region where the sampled outgoing light is located to obtain the position and direction of the outgoing light;

[0011] S4: Repeat steps S1-S3 until the positions and directions of all outgoing light rays are calculated based on all incident light rays incident on the optical surface, and the light sampling is completed.

[0012] Furthermore, step S1 specifically includes:

[0013] S11: The intersection of the incident light and the optical surface is used as the origin to establish a spherical coordinate system, and the zenith angle of the spherical coordinate system is defined as , the azimuth of the spherical coordinate system is ;

[0014] S12: Divide the energy by angle on the unit sphere. is the number of regions divided in the zenith angle direction, is the number of regions divided in the azimuth direction, and the zenith angle interval corresponding to each sub-region obtained after division is and azimuth angle interval They are:

[0015] ;

[0016] ;

[0017] in, , , , ;

[0018] S13: Based on the zenith angle interval corresponding to each sub-area and azimuth angle interval , calculate the coordinates of the center point of each sub-area ( , ):

[0019] ;

[0020] ;

[0021] in, is the i-th zenith angle The central value of is the center value of the j-th azimuth, , ;

[0022] S14: Based on the calculation result of step S13, the energy distribution of each sub-region is calculated by the following formula to obtain the two-dimensional joint distribution of scattered energy:

[0023] ;

[0024] ;

[0025] Among them, BSDF is the bidirectional scattering distribution function, is the normalized energy in the sub-region divided by the zenith angle (subscript i) and the azimuth angle (subscript j), is the random variable of the zenith angle center value, is the azimuth center value random variable.

[0026] Furthermore, step S2 specifically includes:

[0027] S21: Calculate the marginal distribution function with respect to the zenith angle based on the two-dimensional joint distribution of scattered energy:

[0028] ;

[0029] in, is the marginal distribution function about the zenith angle;

[0030] S22: Generate a first random number , and based on the first random number Sampling the zenith angle of each sub-area will satisfy Zenith angle subscript as the zenith angle subscript of the subregion where the outgoing ray is located;

[0031] S23: Based on , calculate the zenith angle subscript The conditional probability distribution of the azimuth angles of the corresponding sub-regions;

[0032] S24: Generate a second random number , and based on the second random number Zenith angle subscript The azimuth angles of the corresponding sub-areas are sampled to meet the Azimuth subscript of Serves as the azimuth subscript of the subregion where the outgoing ray is located.

[0033] Furthermore, step S3 specifically includes:

[0034] S31: Generate a third random number , subscripted in the zenith angle The zenith angle is uniformly and randomly sampled in the corresponding sub-area to obtain the target zenith angle :

[0035] ;

[0036] ;

[0037] ;

[0038] in, and Both express the target zenith angle The intermediate parameters have no actual physical meaning;

[0039] S32: Generate a fourth random number , in the azimuth subscript The azimuth angle in the corresponding sub-area is uniformly randomly sampled to obtain the target azimuth angle :

[0040] ;

[0041] S33: Based on target zenith angle and target azimuth Compute the direction cosines of the incident ray:

[0042] ;

[0043] Where l is the direction cosine of the outgoing light in the x direction, m is the direction cosine of the outgoing light in the y direction, and n is the direction cosine of the outgoing light in the z direction;

[0044] S34: Positioning the outgoing light ray based on the direction cosine and the incident position of the incident light ray.

[0045] Compared with the prior art, the present invention can achieve the following beneficial effects:

[0046] (1) The 2D BSDF-based ray sampling method described in this invention has high universality. In practice, BSDF data often have complex functional forms and cannot be sampled using inverse transform algorithms. However, the algorithm in this invention allows sampling given the BSDF data at the center point of each subregion.

[0047] (2) The present invention creates a light sampling method based on a two-dimensional BSDF, which is relatively fast. For each BSDF's two-dimensional data, sampling can be performed after the edge probability density distribution function and conditional distribution function are calculated in advance based on two angle values. The present invention can obtain two required angle data using four random numbers each time, eliminating the problem of repeated sampling. Therefore, using the sampling method of the present invention can more quickly obtain light data when analyzing large quantities of light. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings, which constitute part of the present invention, are intended to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are intended to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:

[0049] Figure 1 A schematic diagram of a flow chart of a two-dimensional BSDF-based light sampling method according to an embodiment of the present invention;

[0050] Figure 2 A schematic diagram of the structure of the spherical coordinate system according to an embodiment of the present invention;

[0051] Figure 3 This is a flow chart of the sampling of outgoing light according to an embodiment of the present invention;

[0052] Figure 4 A schematic diagram of the scattering principle described in an embodiment of the present invention;

[0053] Figure 5 The normalized illuminance distribution diagram described in the embodiment of the present invention is created;

[0054] Figure 6 This is a comparison chart of normalized illumination between the invention described in the embodiment of the invention and measured data. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.

[0056] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.

[0057] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second" and the like are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, features defined as "first", "second" and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.

[0058] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "installed," "connected," and "connected" should be understood in a broad sense. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to internal connections between two components. Those skilled in the art can understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0059] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments.

[0060] like Figure 1 As shown, the present invention proposes a light sampling method based on a two-dimensional BSDF, which specifically includes the following steps:

[0061] S1: A spherical coordinate system is established based on the incident light on the optical surface, and the energy is divided at the angle of the unit sphere to obtain the two-dimensional joint distribution of the scattered energy;

[0062] S2: Sample each sub-region using the two-dimensional joint distribution of scattered energy to obtain the zenith angle subscript and azimuth angle subscript of the sub-region where the outgoing light is located;

[0063] S3: uniformly and randomly sample the zenith angle and azimuth angle within the sub-region where the sampled outgoing light is located to obtain the position and direction of the outgoing light;

[0064] S4: Repeat steps S1-S3 until the positions and directions of all outgoing light rays are calculated based on all incident light rays incident on the optical surface, and the light sampling is completed.

[0065] It should be noted that the present invention first establishes a spatial spherical coordinate system on the scattering surface. Within this spherical coordinate system, two dimensions are independently divided by angle to form a series of sub-regions. Holistic sampling is then performed based on the two-dimensional energy distribution of each sub-region. Subsequently, further interpolation sampling is performed within the sub-regions using a uniform distribution, thereby obtaining the distribution of light in all directions after passing through the scattering surface.

[0066] In some embodiments, step S1 specifically includes:

[0067] S11: The intersection of the incident light and the optical surface is used as the origin to establish a spherical coordinate system, and the zenith angle of the spherical coordinate system is defined as , the azimuth of the spherical coordinate system is ;

[0068] S12: Divide the energy by angle on the unit sphere. is the number of regions divided in the zenith angle direction, is the number of regions divided in the azimuth direction, and the zenith angle interval corresponding to each sub-region obtained after division is and azimuth angle interval They are:

[0069] ;

[0070] ;

[0071] in, , , , ;

[0072] S13: Based on the zenith angle interval corresponding to each sub-area and azimuth angle interval , calculate the coordinates of the center point of each sub-area ( , ):

[0073] ;

[0074] ;

[0075] in, is the i-th zenith angle The central value of is the center value of the j-th azimuth, , ;

[0076] S14: Based on the calculation result of step S13, the energy distribution of each sub-region is calculated by the following formula to obtain the two-dimensional joint distribution of scattered energy:

[0077] ;

[0078] ;

[0079] Among them, BSDF is the bidirectional scattering distribution function, is the normalized energy in the sub-region divided by the zenith angle (subscript i) and the azimuth angle (subscript j), is the random variable of the zenith angle center value, is the azimuth center value random variable.

[0080] It should be noted that modeling and analyzing a scattering surface is also the basis for stray radiation analysis. When a beam of light is incident on an optical surface, such as Figure 2 As shown, a spherical coordinate system is established for the incident position.

[0081] Assume that the zenith angle variable and azimuth angle variable in space are and For optical surfaces, when the energy and direction of the incident light are fixed, the BSDF data represents the differential scattered light flux within the differential projection solid angle, which is The total energy in is given as follows:

[0082] ;

[0083] When the range of the zenith angle and azimuth angle is the entire hemisphere, the integral is the total scattering integral TIS (Total Integrated Scattering) of the BSDF.

[0084] like Figure 2 As shown, the unit sphere is divided into and Divided into a series of sub-regions, They are and The number of regions divided by the direction. The size of the solid angle corresponding to each sub-region is and It can be calculated by the following formula. Commonly, for a hemisphere, the region boundary value is .

[0085] ;

[0086] Assume that the size of each sub-region at the center point after dividing the angle grid is ,in . and is the coordinate value of the center point of each sub-region after dividing the angle grid:

[0087] ;

[0088] ;

[0089] After knowing the BSDF data at each center point, first calculate the energy distribution function in each sub-region through the BSDF expression and normalize it. The calculation method is as follows:

[0090] ;

[0091] Based on the above analysis, the energy distribution of each scattering area can be obtained:

[0092] (5);

[0093] In step 1, the basic modeling work is completed and the two-dimensional joint distribution function of the scattered energy is obtained. Sampling will be carried out next.

[0094] In some embodiments, step S2 specifically includes:

[0095] S21: Calculate the marginal distribution function with respect to the zenith angle based on the two-dimensional joint distribution of scattered energy:

[0096] ;

[0097] in, is the marginal distribution function about the zenith angle;

[0098] S22: Generate a first random number , and based on the first random number Sampling the zenith angle of each sub-area will satisfy Zenith angle subscript as the zenith angle subscript of the subregion where the outgoing ray is located;

[0099] S23: Based on , calculate the zenith angle subscript The conditional probability distribution of the azimuth angles of the corresponding sub-regions;

[0100] S24: Generate a second random number , and based on the second random number Zenith angle subscript The azimuth angles of the corresponding sub-areas are sampled to meet the Azimuth subscript of Serves as the azimuth subscript of the subregion where the outgoing ray is located.

[0101] It should be noted that the two-dimensional joint distribution of scattered energy is first used to solve the zenith angle The marginal distribution function of is calculated as: After the calculation is completed, the zenith angle is calculated using the edge distribution law. Sampling is performed, and then a random number is generated by the computer , if a subregion is subscripted satisfy , then the zenith angle obtained by sampling The subscript of .

[0102] Complete zenith angle After sampling, the azimuth Sampling is performed for the azimuth The sampling needs to meet the Therefore, first of all, , calculate about all azimuths The conditional probability distribution of , and then use the computer to generate any random number , if a subregion is subscripted satisfy , then the pitch angle obtained by sampling is The subscript of .

[0103] In some embodiments, step S3 specifically includes:

[0104] S31: Generate a third random number , subscripted in the zenith angle The zenith angle is uniformly and randomly sampled in the corresponding sub-area to obtain the target zenith angle :

[0105] ;

[0106] ;

[0107] ;

[0108] in, and Both express the target zenith angle The intermediate parameters have no actual physical meaning;

[0109] S32: Generate a fourth random number , in the azimuth subscript The azimuth angle in the corresponding sub-area is uniformly randomly sampled to obtain the target azimuth angle :

[0110] ;

[0111] S33: Based on target zenith angle and target azimuth Compute the direction cosines of the incident ray:

[0112] ;

[0113] Where l is the direction cosine of the outgoing light in the x direction, m is the direction cosine of the outgoing light in the y direction, and n is the direction cosine of the outgoing light in the z direction;

[0114] S34: Positioning the outgoing light ray based on the direction cosine and the incident position of the incident light ray.

[0115] It should be noted that in order to achieve more detailed results, after completing the sub-region sampling, further sampling is required for the obtained sub-region. In order to obtain a faster sampling speed, further sampling can be performed within the sub-region using interpolation. Here, a random number is generated first. , and then sample the target zenith angle :

[0116] ;

[0117] in, , .

[0118] Generate a random number , the sampled azimuth is:

[0119] ;

[0120] At this point, the angle sampling of a single ray is completed in the energy space of the BSDF, and the direction cosine of the incident ray can be calculated based on the angle:

[0121] ;

[0122] Using the direction cosines of the incident light The outgoing light can be accurately located by sampling the incident light and the incident position. By repeatedly sampling, the outgoing light after each incident light passes through the scattering surface can be obtained.

[0123] Furthermore, by tracing a scattered light surface using the above method, after completing the light sampling, the light is traced to the target surface for energy statistical analysis. Here, Gauss scattering is used as an example for illumination analysis. The distribution function of the BSDF of Gauss scattering is as follows, where :

[0124] ;

[0125] in, is the BSDF value in the normal direction, is the standard deviation of the Gaussian function in the x direction, is the standard deviation of the Gaussian function in the y direction.

[0126] For this BSDF distribution, when sampling light, on the one hand, the inverse transformation method fails due to the difficulty in solving the inverse function of Gauss scattering; on the other hand, the smaller the variance parameter in the Gaussian scattering model, the steeper the image of the Gauss function. For such a function, if the rejection sampling method is used directly, repeated sampling will occur, especially at the edge, which is inefficient. Figure 3 The algorithm flow chart shown is for Figure 4 The scattering surface shown is modeled and analyzed by ray sampling.

[0127] In the present invention, the light emitted by the light source is incident on the scattering surface. The total energy of the light is 1W, and the standard deviations of the two directions in Gauss scattering are set to , each scattering sub-region corresponds to and For optical surfaces, the values ​​of optical surface parameters are shown in Table 1.

[0128] Table 1

[0129]

[0130] use Figure 3 The algorithm mentioned above performs light sampling, and the number of sampled rays is 10 8 Each ray carries 10 -8 W, the energy distribution of the scattered light after the light on the target surface passes through the target surface is as follows Figure 5 At the same time, the normalized illuminance distribution of the target surface is compared with the results of the optical design software. The normalized illuminance comparison results in the Y=0 direction are shown as follows: Figure 6 shown.

[0131] After ray tracing using the present invention, light sampling took less than 20 seconds. When ignoring energy absorption by the scattering surface, the total illuminance of the receiving surface was 0.84892W, while the measured total illuminance was 0.84899W, with a relative error of less than 0.01%. In addition to the total illuminance, a quantitative comparison of the normalized illuminance of each receiver on the receiving surface with the optical design software revealed a relative error of less than 2%, demonstrating high accuracy. This completes the verification of scattered light sampling using the present invention.

[0132] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved. This is not limited herein.

[0133] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A light sampling method based on a two-dimensional BSDF, characterized by: The specific steps include: S1: A spherical coordinate system is established based on the incident light on the optical surface, and the energy is divided at the angle of the unit sphere to obtain the two-dimensional joint distribution of the scattered energy; Step S1 specifically includes: S11: The intersection of the incident light and the optical surface is used as the origin to establish a spherical coordinate system, and the zenith angle of the spherical coordinate system is defined as , the azimuth of the spherical coordinate system is ; S12: Divide the energy by angle on the unit sphere. is the number of regions divided in the zenith angle direction, is the number of regions divided in the azimuth direction, and the zenith angle interval corresponding to each sub-region obtained after division is and azimuth angle interval They are: ; ; in, , , , ; S13: Based on the zenith angle interval corresponding to each sub-area and azimuth angle interval , calculate the coordinates of the center point of each sub-area ( , ): ; ; in, is the center value of the i-th zenith angle, is the center value of the j-th azimuth, , ; S14: Based on the calculation result of step S13, the energy distribution of each sub-region is calculated by the following formula to obtain the two-dimensional joint distribution of scattered energy: ; ; Among them, BSDF is the bidirectional scattering distribution function, is the normalized energy in the sub-region divided by the zenith angle (subscript i) and the azimuth angle (subscript j), is the random variable of the zenith angle center value, is the azimuth center value random variable; S2: Sample each sub-region using the two-dimensional joint distribution of scattered energy to obtain the zenith angle subscript and azimuth angle subscript of the sub-region where the outgoing light is located; The step S2 specifically includes: S21: Calculate the marginal distribution function with respect to the zenith angle based on the two-dimensional joint distribution of scattered energy: ; in, is the marginal distribution function about the zenith angle; S22: Generate a first random number , and based on the first random number Sampling the zenith angle of each sub-area will satisfy Zenith angle subscript As the zenith angle subscript of the subregion where the outgoing ray is located; S23: Based on , calculate the zenith angle subscript The conditional probability distribution of the azimuth angles of the corresponding sub-regions; S24: Generate a second random number , and based on the second random number Zenith angle subscript The azimuth angles of the corresponding sub-areas are sampled to meet the requirements. Azimuth subscript of As the azimuth subscript of the subregion where the outgoing ray is located; S3: uniformly and randomly sample the zenith angle and azimuth angle within the sub-region where the sampled outgoing light is located to obtain the position and direction of the outgoing light; S4: Repeat steps S1-S3 until the positions and directions of all outgoing light rays are calculated based on all incident light rays incident on the optical surface, and the light sampling is completed.

2. The light sampling method based on a two-dimensional BSDF according to claim 1, characterized in that: Step S3 specifically includes: S31: Generate a third random number , subscripted in the zenith angle The zenith angle is uniformly and randomly sampled in the corresponding sub-area to obtain the target zenith angle : ; ; ; in, and Both express the target zenith angle The intermediate parameters have no actual physical meaning; S32: Generate a fourth random number , in the azimuth subscript The azimuth angle in the corresponding sub-area is uniformly randomly sampled to obtain the target azimuth angle : ; S33: Based on target zenith angle and target azimuth Compute the direction cosines of the incident ray: ; Where l is the direction cosine of the outgoing light in the x direction, m is the direction cosine of the outgoing light in the y direction, and n is the direction cosine of the outgoing light in the z direction; S34: Positioning the outgoing light ray based on the direction cosine and the incident position of the incident light ray.

Citation Information

Patent Citations

  • Space-time noise masking and sampling using vectors for image processing and light transport simulation systems and applications

    CN115439341A

  • Rendering method and device and storage medium

    CN115690284A