A method and system for accelerating volumetric scattering ray tracing based on probabilistic absorption

CN122695065BActive Publication Date: 2026-10-16上海芯钬量子科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611170781.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-04
Publication Date
2026-10-16
Estimated Expiration
2046-08-04

AI Technical Summary

Technical Problem

[0003]在现有常用的功率衰减方法中,为了保证仿真精度,通常需要追踪大量光线直至其能量耗尽或穿出介质,尤其因此当光线数比较多,平均自由程较小,参数g接近于0的情况下,每条光线都进行追踪直到结束,会耗费大量计算量直到光线功率小于阈值

Benefits of technology

[0019] This specification also provides a computer-readable storage medium that stores one or more programs/instructions that, when executed by a processor, implement any of the methods described above.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122695065B_ABST
    Figure CN122695065B_ABST
Patent Text Reader

Abstract

The application provides a body scattering light ray tracing acceleration method and system based on probability absorption, relates to the field of light ray tracing simulation, and comprises triggering a body scattering event based on a current intersection state of a current light ray in a target medium; generating an acceleration random number in response to the body scattering event; determining a current relative power of the current light ray according to probability absorption determination of the acceleration random number and a retention probability; evaluating a tracking process of the current light ray through the current relative power; specifically, if the current relative power is zero, terminating a subsequent tracking process of the current light ray; if the current relative power is not zero, performing this scattering simulation of the current light ray based on the current intersection state through an HG function; under the premise of ensuring body scattering physical consistency, effectively reducing the body scattering calculation complexity through the probability absorption mechanism, eliminating the threshold sensitivity problem caused by power splitting, and improving the overall simulation efficiency of the light ray tracing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of ray tracing simulation, and in particular to a method and system for accelerating volume scattering ray tracing based on probability absorption. Background Technology

[0002] In Henyey In Greenstein volume scattering simulations, when the mean free path of the target medium is much smaller than the volume of the scattering object, and the parameter g approaches 0, light will undergo a large number of cyclic isotropic scatterings within the medium.

[0003] In existing commonly used power attenuation methods, in order to ensure simulation accuracy, it is usually necessary to track a large number of rays until their energy is exhausted or they pass through the medium. This is especially true when the number of rays is large, the mean free path is small, and the parameter g is close to 0. Tracking each ray until the end will consume a lot of computation until the ray power is less than the threshold.

[0004] This paper proposes a method, system, computer device, computer-readable storage medium, and computer program product for accelerating volume scattering ray tracing based on probability absorption. Summary of the Invention

[0005] This specification provides a volume scattering ray tracing acceleration method, system, computer device, computer-readable storage medium, and computer program product based on probability absorption. It replaces power attenuation with probability absorption, achieving Henyey ray tracing acceleration while maintaining consistency with the expected physical results of volume scattering. Greenstein volume scattering ray tracing to solve existing Henyey problems The Greenstein volume scattering method suffers from problems such as large computational load due to successive power attenuation calculations and susceptibility to simulation result deviations caused by the power threshold.

[0006] This application provides a volume scattering ray tracing acceleration method based on probability absorption, which employs the following technical solution: A volume scattering event is triggered based on the current intersection state of the light rays in the target medium. In response to the volume scattering event, an accelerated random number is generated; Based on the acceleration random number and the retention probability, a probability absorption determination is performed to determine the current relative power of the current light ray; specifically, if the acceleration random number is greater than the retention probability, it is determined that the current light ray is probabilistically absorbed, and the current relative power is set to zero; if the acceleration random number is less than or equal to the retention probability, it is determined that the current light ray is not absorbed, and the original relative power of the current light ray is used as the current relative power. The tracking progress of the current ray is evaluated by the current relative power; specifically, if the current relative power is zero, the subsequent tracking process of the current ray is terminated; if the current relative power is not zero, the current scattering simulation of the current ray is performed based on the current intersection state using the Henyey-Greenstein phase function.

[0007] Optionally, triggering the volume scattering event based on the current intersection state of the current light rays in the target medium includes: Obtain the current intersection state; the current intersection state includes: the tracking information of the current ray and the medium information of the target medium; Determine whether the current light ray exists in the target medium; If the current light exists in the target medium, then a scattering feasibility analysis is performed on the current light in the target medium in conjunction with the current intersection state, and a volume scattering event is triggered based on the analysis results.

[0008] Optionally, the step of performing a scattering feasibility analysis on the current light in the target medium in conjunction with the current intersection state, and triggering a volume scattering event based on the analysis results, includes: Based on the medium information, calculate the characteristic distance at which the current light does not scatter in the target medium; Generate free random numbers based on the magnitude of the feature distance; The feature distance is mapped to the actual distance traveled by the current ray in the target medium using the free random number; The target distance from the incident point of the current ray to the boundary of the target medium is determined based on the tracking information; wherein, the target distance is the geometric distance from the incident point along the incident direction to the boundary of the target medium; The triggering of a volume scattering event is determined by comparing the actual distance with the target distance; specifically, it is determined whether the actual distance is less than the target distance. If so, a volume scattering event is determined to have occurred; otherwise, surface interaction processing is performed on the current light.

[0009] Optionally, the step of performing the current scattering simulation of the current ray based on the current intersection state using the Henyey-Greenstein phase function includes: Establish a new intersection state; determine the scattering point based on the current ray tracking information and the actual distance; Generate two independent simulated random numbers based on the ray ID of the current ray; The scattering direction of the current light at the scattering point is sampled using the Henyey-Greenstein phase function based on the simulated random numbers.

[0010] Optionally, sampling the scattering direction of the current light at the scattering point based on the simulated random number using the Henyey-Greenstein phase function includes: Integrating the Henyey-Greenstein phase function on a sphere yields the cumulative distribution of scattering angles; The scattering angle is obtained by inversely mapping the cumulative distribution relationship using the first simulated random number; The azimuth angle is generated based on the product of the second simulated random number and the preset angle coefficient; The scattering direction is obtained by combining the scattering angle and the azimuth angle.

[0011] Optionally, the step of evaluating the ray tracing progress using the current relative power further includes: Based on the scattering direction, the tracking information in the new intersection state is updated; wherein, the scattering direction is taken as the incident direction in the new intersection state, and the scattering point is taken as the incident point in the new intersection state; The new intersection state is used as the new current intersection state to re-determine whether the volume scattering event is triggered.

[0012] This application provides a volume scattering ray tracing acceleration system based on probability absorption, which employs the following technical solution: The event triggering module is used to trigger volume scattering events based on the current intersection state of the light rays in the target medium. An accelerated random number generation module is used to generate accelerated random numbers in response to the volume scattering event; An acceleration module is used to determine the current relative power of the current light ray by performing a probability absorption determination based on the acceleration random number and the retention probability. The acceleration module includes a first determination module and a second determination submodule. If the acceleration random number is greater than the retention probability, the first determination submodule determines that the current light ray is probabilistically absorbed, and the current relative power is set to zero. If the acceleration random number is less than or equal to the retention probability, the second determination submodule determines that the current light ray is not absorbed, and the original relative power of the current light ray is used as the current relative power. An evaluation module is used to evaluate the tracking progress of the current ray based on the current relative power. The evaluation module includes a first evaluation submodule and a second evaluation submodule. If the current relative power is zero, the subsequent tracking process of the current ray is terminated based on the first evaluation submodule. If the current relative power is not zero, the current scattering simulation of the current ray is performed based on the Henyey-Greenstein phase function and the current intersection state, using the second evaluation submodule.

[0013] Optionally, the event triggering module includes: The state acquisition submodule is used to acquire the current intersection state; the current intersection state includes: the tracking information of the current ray and the medium information of the target medium; An internal judgment submodule is used to determine whether the current light ray exists in the target medium; The feasibility analysis submodule is used to perform a scattering feasibility analysis on the current light in the target medium in combination with the current intersection state if the current light exists in the target medium, and trigger a volume scattering event based on the analysis results.

[0014] Optionally, the feasibility analysis submodule includes: The feature distance calculation unit is used to calculate the feature distance at which the current light does not scatter in the target medium based on the medium information. A free random number generation unit is used to generate free random numbers based on the magnitude of the feature distance; The actual distance calculation unit is used to map the feature distance to the actual distance traveled by the current ray in the target medium using the free random number; A target distance calculation unit is used to determine the target distance from the incident point of the current ray to the boundary of the target medium based on the tracking information; wherein, the target distance is the geometric distance from the incident point along the incident direction to the boundary of the target medium; The event triggering unit is used to determine the triggering of a volume scattering event by comparing the actual distance with the target distance; specifically, it compares whether the actual distance is less than the target distance. If so, it determines that a volume scattering event has occurred; otherwise, it performs surface interaction processing on the current light.

[0015] Optionally, the second evaluation submodule includes: A new state creation unit is used to establish a new intersection state; the scattering point is determined based on the current ray tracking information and the actual distance; The simulated random number generation unit is used to generate two independent simulated random numbers based on the ray ID of the current ray; The sampling unit is used to sample the scattering direction of the current light at the scattering point based on the simulated random number using the Henyey-Greenstein phase function.

[0016] Optionally, the sampling unit includes: An integrator subunit is used to integrate the Henyey-Greenstein phase function on a sphere to obtain the cumulative distribution of the scattering angles; The scattering angle calculation subunit is used to inversely map the cumulative distribution relationship using a first simulation random number to obtain the scattering angle; An azimuth calculation subunit is used to generate the azimuth angle based on the product of a second simulation random number and a preset angle coefficient. The scattering direction calculation subunit is used to combine the scattering angle and the azimuth angle to obtain the scattering direction.

[0017] Optionally, the evaluation module further includes: An update submodule is used to update the tracking information in the new intersection state based on the scattering direction; wherein the scattering direction is used as the incident direction in the new intersection state, and the scattering point is used as the incident point in the new intersection state. The loop submodule is used to take the new intersection state as the new current intersection state and re-determine whether the volume scattering event is triggered.

[0018] This specification also provides a computer device, wherein the computer device includes: Processor; and, A memory that stores computer-executable instructions, which, when executed, cause the processor to perform any of the methods described above.

[0019] This specification also provides a computer-readable storage medium that stores one or more programs / instructions that, when executed by a processor, implement any of the methods described above.

[0020] This specification also provides a computer program product, wherein the computer program product includes: a computer program / instruction, which, when executed by a processor, implements any of the methods described above.

[0021] This invention significantly reduces the computational load of volume scattering sampling and ray tracing by replacing traditional power attenuation processing with probabilistic absorption, without changing the expected physical results of volume scattering, thus effectively improving rendering efficiency. At the same time, since it no longer relies on power thresholds to forcibly terminate rays, it eliminates the influence of threshold settings on simulation results, ensuring the physical consistency and stability of simulation results. Attached Figure Description

[0022] Figure 1 A flowchart illustrating a volume scattering ray tracing acceleration method based on probability absorption, provided for embodiments of this specification. Figure 1 ; Figure 2 A flowchart illustrating a volume scattering ray tracing acceleration method based on probability absorption, provided for embodiments of this specification. Figure 2 ; Figure 3 A flowchart illustrating a volume scattering ray tracing acceleration method based on probability absorption, provided for embodiments of this specification. Figure 3 ; Figure 4 A schematic diagram of a volume scattering ray tracing acceleration system based on probability absorption, provided as an embodiment of this specification; Figure 5 A schematic diagram of the structure of a computer device provided in the embodiments of this specification; Figure 6 This is a schematic diagram of a computer-readable storage medium provided for an embodiment of this specification. Detailed Implementation

[0023] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious variations will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.

[0024] Exemplary embodiments of the invention will now be described more fully with reference to the accompanying drawings. While conforming to the inventive concept, the features, structures, characteristics, or other details described in a particular embodiment may be combined in one or more other embodiments in a suitable manner.

[0025] The terms “and / or” or “and / or” include all combinations of any one or more of the listed items.

[0026] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

[0027] Figure 1 A flowchart illustrating a volume scattering ray tracing acceleration method based on probability absorption, provided for embodiments of this specification, includes: S1 triggers a volume scattering event based on the current intersection state of the light rays in the target medium. S2 responds to the volume scattering event by generating accelerated random numbers; S3 performs probability absorption determination based on the accelerated random number and the retention probability to determine the current relative power of the current light ray; specifically, if the accelerated random number is greater than the retention probability, it is determined that the current light ray is probability absorbed and the current relative power is set to zero; if the accelerated random number is less than or equal to the retention probability, it is determined that the current light ray is not absorbed and the original relative power of the current light ray is used as the current relative power. S4 evaluates the tracking progress of the current ray based on the current relative power; specifically, if the current relative power is zero, the subsequent tracking process of the current ray is terminated; if the current relative power is not zero, the current scattering simulation of the current ray is performed based on the current intersection state using the Henyey-Greenstein phase function.

[0028] This invention relates to an accelerated method for volume scattering ray tracing based on probabilistic absorption. Specifically, it discloses an accelerated ray tracing method for Henyey-Greenstein volume scattering based on probabilistic absorption. By replacing power loss with probabilistic absorption, the computational complexity of Henyey-Greenstein volume scattering is significantly reduced, thereby accelerating volume scattering ray tracing. Figure 2-3 As shown, it specifically includes: S1 triggers a volume scattering event based on the current intersection state of the light rays in the target medium.

[0029] S11 Obtain the current intersection state; the current intersection state includes: the current ray tracking information and the medium information of the target medium.

[0030] Tracking information characterizes the current state of light within the target medium, including but not limited to: the point of incidence and the direction of incidence. Intersection distance .

[0031] Intersection distance refers to the geometric distance at which the object first intersects the target medium while traveling along the incident direction from the point of incidence.

[0032] Medium information refers to the set of optical properties required to describe the scattering, absorption, and transmission behavior of a target medium to light, including but not limited to: scattering coefficient. (Scattering Coefficient) .

[0033] In one embodiment of this specification, a ray tracing state container is constructed. Ray tracing state container This is used to store each intersection state sequentially. The tracing and media information within each intersection state is object data. The current intersection state is a container for ray tracing states. The latest intersection state is stored. The intersection distance in the current intersection state is denoted as... .

[0034] S12 determines whether the current light exists in the target medium.

[0035] If the current light exists in the target medium ( If the current ray does not exist in the target medium, then proceed with the subsequent steps for efficient ray tracing; If ), then surface interaction processing is performed on the current light.

[0036] In one embodiment of this specification, surface interaction processing refers to the processing of the surface optical components after the current light leaves the target medium, which includes, but is not limited to, reflection, refraction, and transmission.

[0037] Surface interaction processing can be performed by a surface optical processing unit, which is a processing module in the renderer used to calculate the reflection, refraction, or transmission behavior of light based on the optical properties of the medium surface.

[0038] S13 If the current light exists in the target medium, then perform a scattering feasibility analysis on the current light in the target medium in conjunction with the current intersection state, and trigger a volume scattering event based on the analysis results.

[0039] S131 calculates the characteristic distance at which the current light does not scatter in the target medium based on the medium information.

[0040] The characteristic distance is the expected value of the distance that the current light ray can travel in the target medium without scattering.

[0041] In one embodiment of this specification, the characteristic distance is preferably the mean free path. (Mean FreePath). Where the mean free path is the scattering coefficient. The reciprocal of, that is, Reduced scattering coefficient (Reduced Scattering Coefficient) and Scattering Coefficient There is a linear relationship, that is, .in, It is an asymmetric parameter. Therefore, it is easy to understand that the free path, in addition to the mean free path, is... In addition, it can also be determined by the scattering coefficient. Reduced scattering coefficient , or other physical quantities that can be converted into each other.

[0042] In one embodiment of this specification, the feature distance is stored as medium information in the current intersection state.

[0043] S132 generates free random numbers based on the magnitude of the feature distance.

[0044] Determine whether the feature distance is finite; that is, determine Is it infinitely large?

[0045] If the feature distance is finite ( (If not infinite), then generate a free random number based on the ray ID of the current ray. ;otherwise( (where the value is infinitely large), and perform surface interaction processing on the current light.

[0046] Free random numbers The value range is [0.1].

[0047] S133 maps the feature distance to the actual distance the current ray travels in the target medium using the free random number.

[0048] Actual distance refers to the actual distance that light travels in the target medium until it is scattered or absorbed. In one embodiment of this specification, the actual distance is the actual path of freedom. (Free Path Length).

[0049] As a preferred method, it is based on free random numbers. Randomly sample the actual free path from the exponential distribution. Specifically: In a medium that scatters light without scattering, the distance traveled follows an exponential distribution with a probability density function. ; For probability density Integrating, we obtain the distance Distribution probability of internal scattering , ; For probability distribution Find the inverse, and you will get .

[0050] In actual sampling, uniformly distributed free random numbers with values ​​ranging from [0,1] are used. replace .because Still follows a uniform distribution in [0,1], As At this point, the actual free path .

[0051] This invention determines whether light scattering occurs inside the target medium by comparing the actual free path with the distance from the incident point of the current light to the surface of the target medium, thereby deciding whether to perform volume scattering sampling.

[0052] S134 determines the target distance from the incident point of the current light to the boundary of the target medium based on the tracking information.

[0053] The target distance is the geometric distance from the point of incidence along the incident direction to the boundary of the target medium.

[0054] S135 determines the triggering of a volume scattering event by comparing the actual distance with the target distance.

[0055] Compare whether the actual distance is less than the target distance. If so, it indicates that the current light is being scattered inside the medium, and a volume scattering event has occurred. Otherwise, it indicates that the current light directly passes through the medium, and in this case, surface interaction processing is performed on the current light. Specifically: Compare whether the actual free path is less than the target distance; If the actual free path is less than the target distance, that is, This indicates that the light beam has not yet reached the boundary of the target medium and has collided with particles inside the target medium, resulting in scattering. At this point, a volume scattering event is determined to have occurred.

[0056] If the actual free path is greater than or equal to the target distance, that is, This indicates that the current light ray passes directly through the target medium surface without colliding with any particles inside the medium. In this case, surface interaction processing is performed on the current light ray. Specifically, the exit point can be determined based on the incident point, incident direction, and distance from the target of the current light ray, and the surface optical processing unit performs surface interaction processing on the current light ray based on the exit point.

[0057] It's easy to understand that during accelerated ray tracing, only when the current ray is located in the target medium ( And it has scattering ability. Only when the mean free path is not infinite (i.e., finite) will subsequent volume scattering calculations proceed. If the current ray does not encounter the target medium or the target medium is a pure vacuum, the volume scattering part is skipped, and surface interaction processing is performed directly.

[0058] S2 generates accelerated random numbers in response to the volume scattering event.

[0059] In response to the volume scattering event, an accelerated random number is generated based on the ray ID of the current ray. Speed ​​up random number generation. The value range is [0.1].

[0060] S3 performs probability absorption determination based on the accelerated random number and retention probability to determine the current relative power of the current light.

[0061] Retention probability is an absorption judgment threshold, determined by comparing it with accelerated random numbers. The relative probability of light absorption in the target medium is compared. In one embodiment of this specification, the retention probability is determined by the medium information of the target medium.

[0062] In one embodiment of this specification, the retention probability is preferably the particle transmittance. (Transmittance). Particle transmittance This refers to the relative power loss in each scattering sampling. The particle transmittance can be generated based on the scattering and absorption coefficients of the target medium; specifically, the scattering coefficient of the target medium is obtained. With absorption coefficient ; scattering coefficient With absorption coefficient The sum of these factors is used as a comprehensive coefficient; the scattering coefficients are then used as a composite coefficient. The ratio of the composite coefficient to the particle transmittance is taken as the particle transmittance. That is, particle transmittance. .

[0063] S31 compares the accelerated random number with the retention probability.

[0064] That is, determine whether the accelerated random number is greater than the retention probability.

[0065] S32 If the accelerated random number is greater than the retention probability, it is determined that the current light is absorbed by probability, and the current relative power is set to zero.

[0066] That is, when accelerating random numbers > Retention probability, current relative power At this point, the sampling process is terminated, and the subsequent volume scattering sampling and ray tracing process of the current ray within the target medium is ended. The lifecycle of this transmission simulation of the current ray is completed.

[0067] S33 If the accelerated random number is less than or equal to the retention probability, it is determined that the current light is not absorbed, and the original relative power of the current light is taken as the current relative power.

[0068] When accelerating random numbers When the retention probability is less than or equal to the current relative power Original relative power At this point, the light is not absorbed (survives), and the subsequent scattering calculations continue.

[0069] In one embodiment of this specification, particle transmittance As a retention probability, when performing probability absorption determination, the accelerated random number is judged. Is it greater than particle transmittance? ;when At that time, the current relative power .when At that time, the current relative power .

[0070] S4 assesses the tracing progress of the current ray using the current relative power.

[0071] S41 If the current relative power is zero, then the subsequent tracking process of the current ray is terminated.

[0072] S42 If the current relative power is not zero, then the current scattering simulation of the current ray is performed based on the current intersection state using the Henyey-Greenstein phase function.

[0073] S421 establishes a new intersection state; determines the scattering point based on the current ray tracking information and the actual distance.

[0074] Establish a new intersection state while preserving the ray tracing state container. For all object data in the current intersection state, the intersection distance is modified to the actual distance. That is, a new intersection state is created based on the current intersection state. This new intersection state retains all object data from the current state, and then the intersection distance in the new state is modified accordingly. Modified to actual free path .

[0075] The scattering point is determined based on the current incident point, incident direction, and actual free path of the light ray; that is, the scattering point is determined by the distance traveled from the current incident point along the incident direction. The point where it is located afterward is marked as the scattering point.

[0076] The geometric update described above adjusts the ray tracing reference from the medium boundary to the scattering point to facilitate subsequent scattering simulations.

[0077] S422 generates two independent simulated random numbers based on the ray ID of the current ray.

[0078] Simulated random numbers are used to inversely sample the Henyey-Greenstein phase function to calculate the specific scattering direction.

[0079] The two independent simulated random numbers include: the first simulated random number. With the second simulation random number .

[0080] The values ​​of the two simulated random numbers are both in the range of [0.1].

[0081] S423 samples the scattering direction of the current light at the scattering point based on the simulated random number using the Henyey-Greenstein phase function.

[0082] The Henyey-Greenstein phase function (HG function) is a classic probabilistic model used to describe the volume scattering of light in a medium, and it is widely used in atmospheric science and life science simulations.

[0083] In one embodiment of this specification, when the actual free path is less than the distance between the incident point of the light and the boundary of the target medium, the present invention samples the scattering direction according to the phase function of Henyey-Greenstein scattering.

[0084] Scattering direction Including: scattering angle With azimuth Among them, the scattering angle This refers to the angle between the scattering direction and the incident direction. Azimuth angle. This refers to the rotation angle of the scattering direction relative to a preset reference axis in a plane perpendicular to the incident direction, with a value range of []. ).

[0085] S423-1 integrates the Henyey-Greenstein phase function on a sphere to obtain the cumulative distribution of scattering angles.

[0086] Henyey-Greenstein phase function .in, The asymmetry parameter is used to determine the scattering direction; specifically... Indicates forward scattering; Indicates backscattering; This indicates isotropic scattering. In one embodiment of this specification, the foregoing... For Henyey The asymmetric parameter of the Greenstein phase function, and the anisotropic parameter used for scattering direction sampling in this specification. They are the same physical quantity.

[0087] Using the probability density function to perform a spherical surface integral of the Henyey-Greenstein phase function, we obtain information about the scattering angle. The cumulative distribution relationship includes: the cumulative distribution function. .

[0088] S423-2 obtains the scattering angle by inversely mapping the cumulative distribution relationship using the first simulated random number.

[0089] Since the cumulative distribution function takes values ​​in the range [0,1], a first simulation random number can be randomly selected within the range [0,1]. Let this be taken as the value of the cumulative distribution function, that is, let The scattering angle is obtained by solving the inverse cumulative distribution function. cosine value , .

[0090] S423-3 generates the azimuth angle based on the product of the second simulated random number and the preset angle coefficient.

[0091] Based on the second simulated random number The azimuth angle is generated by multiplying the azimuth angle by a preset angle coefficient. ; For azimuth angle This invention assumes that the probability distribution is uniform, then the azimuth angle Preset angle coefficient That is, based on the second simulated random number The azimuth angle is generated by multiplying the azimuth angle by a preset angle coefficient. .

[0092] Among them, the preset angle coefficient is That is, azimuth angle .

[0093] S423-4 combines the scattering angle and the azimuth angle to obtain the scattering direction.

[0094] Scattering angle With azimuth The scattering direction, represented by the vector, is rotated to a local coordinate system with the current incident direction as the normal to obtain a new outgoing direction vector. ; This process is determined by the direction sampling function. This is implemented to complete the direction sampling of this volume scattering.

[0095] This invention is based on a first simulated random number. With the second simulation random number and cumulative distribution relationship The scattering direction is calculated using the inverse function of the probability, and then the direction is sampled using the sample function.

[0096] S43 updates the tracking information in the new intersection state based on the scattering direction.

[0097] The scattering direction is taken as the incident direction in the new intersection state, and the scattering point is taken as the incident point in the new intersection state.

[0098] S44 takes the new intersection state as the new current intersection state and re-determines whether the volume scattering event is triggered.

[0099] Store the new intersection state into the ray tracing state container. The current volume scattering sampling is then terminated and used as the new current intersection state, and step S1 is then re-executed.

[0100] In this invention, sampling ends and rendering begins when the current light ray exits the target medium; absorption of the current light ray causes sampling to exit; and scattering generates a new incident point and direction. After scattering sampling ends, a volume scattering event is determined based on the new incident point (scattering point) and the new incident direction; after a volume scattering event is triggered, probability absorption is determined based on particle transmittance, thereby determining the relative power of the current light ray.

[0101] The free random number of the present invention Used to determine distance and speed up random number generation This is used to determine the probability of survival. Simulated random numbers. r11 is used to determine the scattering direction. The values ​​of each random number are all in the range of [0,1], but the random numbers do not interfere with each other.

[0102] In the currently commonly used Henyey In Greenstein's volume scattering method, relative power decays with respect to particle transmittance; that is, the current relative power... After After the second scattering, the current relative power When the number of rays sampled from the light source In a large case, total power .

[0103] The method used in this invention is to generate an accelerated random number before each scattering. When accelerating random numbers When the light is determined to be absorbed, the current relative power is set to zero and all subsequent tracking is terminated. When accelerating random numbers When it is determined that the light has not been absorbed, the current relative power remains the original relative power, that is, Thus, a ray of light travels through... The probability of secondary scattering without absorption is Its expected relative power is This is consistent with the power attenuation method statistics; when sampling from the light source A ray of light and When sufficiently large, the expected total output power is also [missing information]. .

[0104] Compared to traditional power attenuation, Henyey The Greenstein volume scattering method, this invention uses probability absorption to cause light to scatter in a probabilistic manner. By terminating scattering cycles at earlier times, subsequent volume scattering sampling and ray tracing calculations are reduced. Given that scattering event computation is the primary factor, the overall computational cost of this invention is expected to be reduced by a certain percentage. .

[0105] by , , For example, the number of fitted rays Set as Under the same hardware and software environment and for the same test scenario, the running time of the method of this invention is 4.8105 seconds, while the existing method is 5.608 seconds, which improves the computational efficiency by about 14.2%.

[0106] Compared with the commonly used power-splitting (power attenuation / power scaling) Henyey-Greenstein volume scattering algorithm, the computational complexity of this invention is significantly reduced, by a reduction ratio of [percentage missing]. Moreover, it does not require consideration of the influence of the power threshold on the volume scattering process.

[0107] As a special calculation method for Henyey-Greenstein volume scattering simulation, this invention significantly reduces the computational load of Henyey-Greenstein volume scattering by replacing power loss with probabilistic absorption, thereby accelerating volume scattering calculations and avoiding the impact of different results caused by different power thresholds in power spectroscopy.

[0108] Figure 4 A schematic diagram of a volume scattering ray tracing acceleration system based on probability absorption, provided as an embodiment of this specification, is shown. The system includes: Event triggering module 410 is used to trigger a volume scattering event based on the current intersection state of the current light rays in the target medium; The accelerated random number generation module 420 is used to generate accelerated random numbers in response to the volume scattering event; An acceleration module 430 is used to determine the current relative power of the current light ray by performing a probability absorption determination based on the acceleration random number and the retention probability. The acceleration module 430 includes a first determination module and a second determination submodule. If the acceleration random number is greater than the retention probability, the first determination submodule determines that the current light ray is probabilistically absorbed, and the current relative power is set to zero. If the acceleration random number is less than or equal to the retention probability, the second determination submodule determines that the current light ray is not absorbed, and the original relative power of the current light ray is used as the current relative power. Evaluation module 440 is used to evaluate the tracking progress of the current ray based on the current relative power. Evaluation module 440 includes a first evaluation submodule and a second evaluation submodule. If the current relative power is zero, the subsequent tracking process of the current ray is terminated based on the first evaluation submodule. If the current relative power is not zero, the current scattering simulation of the current ray is performed based on the Henyey-Greenstein phase function and the current intersection state based on the second evaluation submodule.

[0109] Optionally, the event triggering module 410 includes: The state acquisition submodule is used to acquire the current intersection state; the current intersection state includes: the tracking information of the current ray and the medium information of the target medium; An internal judgment submodule is used to determine whether the current light ray exists in the target medium; The feasibility analysis submodule is used to perform a scattering feasibility analysis on the current light in the target medium in combination with the current intersection state if the current light exists in the target medium, and trigger a volume scattering event based on the analysis results.

[0110] Optionally, the feasibility analysis submodule includes: The feature distance calculation unit is used to calculate the feature distance at which the current light does not scatter in the target medium based on the medium information. A free random number generation unit is used to generate free random numbers based on the magnitude of the feature distance; The actual distance calculation unit is used to map the feature distance to the actual distance traveled by the current ray in the target medium using the free random number; A target distance calculation unit is used to determine the target distance from the incident point of the current ray to the boundary of the target medium based on the tracking information; wherein, the target distance is the geometric distance from the incident point along the incident direction to the boundary of the target medium; The event triggering unit is used to determine the triggering of a volume scattering event by comparing the actual distance with the target distance; specifically, it compares whether the actual distance is less than the target distance. If so, it determines that a volume scattering event has occurred; otherwise, it performs surface interaction processing on the current light.

[0111] Optionally, the second evaluation submodule includes: A new state creation unit is used to establish a new intersection state; the scattering point is determined based on the current ray tracking information and the actual distance; The simulated random number generation unit is used to generate two independent simulated random numbers based on the ray ID of the current ray; The sampling unit is used to sample the scattering direction of the current light at the scattering point based on the simulated random number using the Henyey-Greenstein phase function.

[0112] Optionally, the sampling unit includes: An integrator subunit is used to integrate the Henyey-Greenstein phase function on a sphere to obtain the cumulative distribution of the scattering angles; The scattering angle calculation subunit is used to inversely map the cumulative distribution relationship using a first simulation random number to obtain the scattering angle; An azimuth calculation subunit is used to generate the azimuth angle based on the product of a second simulation random number and a preset angle coefficient. The scattering direction calculation subunit is used to combine the scattering angle and the azimuth angle to obtain the scattering direction.

[0113] Optionally, the evaluation module 440 further includes: An update submodule is used to update the tracking information in the new intersection state based on the scattering direction; wherein the scattering direction is used as the incident direction in the new intersection state, and the scattering point is used as the incident point in the new intersection state. The loop submodule is used to take the new intersection state as the new current intersection state and re-determine whether the volume scattering event is triggered.

[0114] This invention triggers a volume scattering event through an event triggering module 410 based on the current intersection state of the current light rays in the target medium; it then generates an accelerated random number in response to the volume scattering event through an accelerated random number generation module 420; and finally, an acceleration module 430 determines the current relative power of the current light ray by performing a probability absorption determination based on the accelerated random number and the retention probability. Specifically, if the accelerated random number is greater than the retention probability, the current light ray is determined to be probabilistically absorbed based on the first determination module in the acceleration module 430, and the current relative power is set to zero; if the accelerated random number is less than or equal to the retention probability, the current relative power is determined based on the probability absorption determination by the acceleration module 430. The second determination submodule in the speed module 430 determines that the current light ray has not been absorbed, and takes the original relative power of the current light ray as the current relative power; based on the evaluation module 440, the tracking progress of the current light ray is evaluated through the current relative power; wherein, if the current relative power is zero, the subsequent tracking process of the current light ray is terminated based on the first evaluation submodule in the evaluation module 440; if the current relative power is not zero, the current scattering simulation of the current light ray is performed based on the current intersection state through the Henyey-Greenstein phase function by the second evaluation submodule in the evaluation module 440.

[0115] Compared with existing technologies, the volume scattering ray tracing acceleration system based on probability absorption provided by this invention significantly reduces the computational load of volume scattering sampling and ray tracing by replacing traditional power attenuation processing with probability absorption, without changing the expected physical results of volume scattering. At the same time, it eliminates the simulation result deviation caused by setting a power threshold to forcibly terminate rays, thus balancing rendering efficiency and physical consistency of results.

[0116] The functions of the system in this embodiment have been described in the above method embodiments. Therefore, for any parts not detailed in this embodiment, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.

[0117] Figure 5This is a schematic diagram of the structure of a computer device provided in an embodiment of this specification. The computer device includes a memory 501 and a processor 502. The memory 501 is used to store computer-executable instructions. When the computer-executable instructions are executed by the processor 502, they can implement the steps of the above-described method embodiments.

[0118] Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of this specification. The computer-readable storage medium 600 stores one or more computer programs, which, when executed by a processor, can implement the steps of the above-described method embodiments.

[0119] This specification also provides a computer program product, including a computer program / computer executable instructions, which, when executed by a processor, can implement the steps of the above-described method embodiments.

[0120] Those skilled in the art will understand that all or part of the processes in the above method embodiments can be implemented by a computer program instructing related hardware. When the computer program is executed, it may include the processes of the embodiments of the above methods.

[0121] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A volume scattering ray tracing acceleration system based on probability absorption, characterized in that, include: The event triggering module is used to trigger volume scattering events based on the current intersection state of the light rays in the target medium. An accelerated random number generation module is used to generate accelerated random numbers in response to the volume scattering event; An acceleration module is used to determine the current relative power of the current light by performing probability absorption determination based on the acceleration random number and the retention probability. The acceleration module includes a first determination module and a second determination submodule; wherein, if the acceleration random number is greater than the retention probability, the first determination submodule determines that the current light is absorbed by probability and sets the current relative power to zero; if the acceleration random number is less than or equal to the retention probability, the second determination submodule determines that the current light is not absorbed and uses the original relative power of the current light as the current relative power. An evaluation module is used to evaluate the tracking progress of the current ray based on the current relative power. The evaluation module includes a first evaluation submodule and a second evaluation submodule. If the current relative power is zero, the subsequent tracking process of the current ray is terminated based on the first evaluation submodule. If the current relative power is not zero, the current scattering simulation of the current ray is performed based on the Henyey-Greenstein phase function and the current intersection state, using the second evaluation submodule.

2. The volume scattering ray tracing acceleration system based on probability absorption as described in claim 1, characterized in that, The event triggering module includes: The state acquisition submodule is used to acquire the current intersection state; the current intersection state includes: the tracking information of the current ray and the medium information of the target medium; An internal judgment submodule is used to determine whether the current light ray exists in the target medium; The feasibility analysis submodule is used to perform a scattering feasibility analysis on the current light in the target medium in combination with the current intersection state if the current light exists in the target medium, and trigger a volume scattering event based on the analysis results.

3. The volume scattering ray tracing acceleration system based on probability absorption as described in claim 2, characterized in that, The feasibility analysis submodule includes: The feature distance calculation unit is used to calculate the feature distance at which the current light does not scatter in the target medium based on the medium information. A free random number generation unit is used to generate free random numbers based on the magnitude of the feature distance; The actual distance calculation unit is used to map the feature distance to the actual distance traveled by the current ray in the target medium using the free random number; A target distance calculation unit is used to determine the target distance from the incident point of the current ray to the boundary of the target medium based on the tracking information; wherein, the target distance is the geometric distance from the incident point along the incident direction to the boundary of the target medium; The event triggering unit is used to determine the triggering of a volume scattering event by comparing the actual distance with the target distance; specifically, it compares whether the actual distance is less than the target distance. If so, it determines that a volume scattering event has occurred; otherwise, it performs surface interaction processing on the current light.

4. The volume scattering ray tracing acceleration system based on probability absorption as described in claim 3, characterized in that, The second evaluation submodule includes: A new state creation unit is used to establish a new intersection state; the scattering point is determined based on the current ray tracking information and the actual distance; The simulated random number generation unit is used to generate two independent simulated random numbers based on the ray ID of the current ray; The sampling unit is used to sample the scattering direction of the current light at the scattering point based on the simulated random number using the Henyey-Greenstein phase function.

5. The volume scattering ray tracing acceleration system based on probability absorption as described in claim 4, characterized in that, The sampling unit includes: An integrator subunit is used to integrate the Henyey-Greenstein phase function on a sphere to obtain the cumulative distribution of the scattering angles; The scattering angle calculation subunit is used to inversely map the cumulative distribution relationship using a first simulation random number to obtain the scattering angle; An azimuth calculation subunit is used to generate the azimuth angle based on the product of a second simulation random number and a preset angle coefficient. The scattering direction calculation subunit is used to combine the scattering angle and the azimuth angle to obtain the scattering direction.

6. The volume scattering ray tracing acceleration system based on probability absorption as described in claim 4, characterized in that, The evaluation module also includes: An update submodule is used to update the tracking information in the new intersection state based on the scattering direction; wherein the scattering direction is used as the incident direction in the new intersection state, and the scattering point is used as the incident point in the new intersection state. The loop submodule is used to take the new intersection state as the new current intersection state and re-determine whether the volume scattering event is triggered.

7. A volume scattering ray tracing acceleration method based on probability absorption, characterized in that, include: A volume scattering event is triggered based on the current intersection state of the light rays in the target medium. In response to the volume scattering event, an accelerated random number is generated; Based on the acceleration random number and the retention probability, a probability absorption determination is performed to determine the current relative power of the current light ray; specifically, if the acceleration random number is greater than the retention probability, it is determined that the current light ray is probabilistically absorbed, and the current relative power is set to zero; if the acceleration random number is less than or equal to the retention probability, it is determined that the current light ray is not absorbed, and the original relative power of the current light ray is used as the current relative power. The tracking progress of the current ray is evaluated by the current relative power; specifically, if the current relative power is zero, the subsequent tracking process of the current ray is terminated; if the current relative power is not zero, the current scattering simulation of the current ray is performed based on the current intersection state using the Henyey-Greenstein phase function.

8. A computer device, characterized in that, The computer device includes: Processor; and, A memory storing computer-executable instructions, which, when executed, cause the processor to perform the method of claim 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs / instructions that, when executed by a processor, implement the method as described in claim 7.

10. A computer program product, characterized in that, Includes a computer program / instruction, which, when executed by a processor, implements the method as described in claim 7.

Citation Information

Patent Citations

  • Diffusion optical imaging method and system based on controlled Monte Carlo method

    CN109342367A

  • BFM random response method, electronic equipment and storage medium

    CN120409374A