How to use importance sampling to model scattering efficiently

OpticStudio has two features that improve scattering efficiency: Scatter To and Importance Sampling. In this article we discuss the details of each and perform a stray light analysis using importance sampling.

Authored By Akash Arora


Article Attachments



Modeling surface scattering is important in many optical systems and is critical for stray light analysis. Accurate modeling of surface scattering can require a large number of rays, which may drastically increase computation time. Thus, it is often necessary to narrow down the analysis by utilizing "Scatter To" or "Importance Sampling". Both of these improve scattering efficiency while maintaining the flexibility to encompass nearly any scattering profile. 

This article will discuss "Importance Sampling", found in the "Scatter To" tab in the object properties dialog.

How to use importance sampling to improve scatter efficiency

Importance sampling is fundamentally different than Scatter To. The “Scatter To” list only traces the scattered rays that interact with the targeted objects. (This doesn’t guarantee that the scattered rays will hit the object). Conversely, if an object is listed in the importance sampling list, OpticStudio will always scatter rays towards a target sphere centered at this object. To account for the scatter profile, OpticStudio will weight the power in these rays so that the flux seen at the object is realistic; the signal to noise ratio is increased. The size of the target sphere and the maximum solid angle it may subtend are specified by the user.

In the system below, a Lambertian surface scatters incident light into a hemisphere. Even with 10 scattered rays per incident ray, few rays make it to the small detector.


Scatter without importance sampling


When importance sampling is enabled, however, numerous rays strike the detector.


Scattering with importance sampling


There are a few important things to understand when using importance sampling. First, the object itself is not the target of scattered rays, but rather a sphere with a given radius, centered at the local origin of the object. Consequently, the target sphere should be made slightly larger than the object to ensure the scattered rays overfill the desired object.

The limit parameter on the target sphere is defined to ensure the BSDF of the scattering surface doesn’t vary too much within the solid angle subtended by the target sphere. This is necessary due to the manner in which OpticStudio apportions power to the scattered rays. As discussed previously, the directions of the rays are independent of the BSDF, so the flux must be weighted properly. Each importance sampled ray targeting a specific object contains the same flux. OpticStudio takes the average of the BSDF within the targeted solid angle and applies flux to each ray accordingly. The scatter function plot below shows a specific range of scatter vector magnitudes (vertical red bars) and the approximate value of the BSDF that OpticStudio would choose for importance sampled rays (horizontal red bar).


BSDF plot


If the BSDF changes appreciably over the solid angle of the target sphere, the flux seen at the target sphere from importance sampled rays will not be accurate.

To get an idea of how importance sampling improves scatter efficiency and analysis time, a comparison of normal scatter and importance sampling is performed. The plot below shows the number of rays striking the detector for a system with 1E5 analysis rays and a target object that subtends approximately 0.2 sr from the point of scatter.


Detector hits plot_IS_vs_no_IS


With importance sampling, several times as many rays hit the desired object in the same amount of time as with one scattered ray. Next, we will look at an example of stray light analysis using importance sampling.


Modeling Scattered Light in a Telescope

The astronomical telescope is one of the most well noted optical systems requiring stray light analysis. The reason for this is because the desired signal (extraterrestrial sources) is often so low that any noise in the form of stray light is very detrimental.

In this example, we will measure the amount of stray light that scatters off the inside of the telescope barrel, ultimately reaching the detector. We will see that by using importance sampling, we increase the number of rays hitting the detector, and get a more accurate measurement of stray light reaching the detector. Open the file “IS.zmx” attached in this article.


Telescope model


The file models a Maksutov telescope with an off-axis light source representing the main source of noise in the system. The light enters the telescope and reflects/scatters from the surface of the barrel. Note: some scattering would also take place at the optical surfaces, but we will concern ourselves with the barrel’s contribution for the purposes of this analysis. We model the telescope barrel with a lambertian scattering profile with 100% of the rays scattering (assume the barrel is machined to stifle specular reflection). If we perform a ray trace, the detector viewer reports the following statistics.

Detector without importance sampling


The detector shows that about 4% of the source rays representing 0.6% of the energy actually make it to the detector. To accurately measure the power on the detector from scattered light, we want as many rays hitting the detector as possible. This is where importance sampling plays a useful role.

We will importance sample a target sphere located at the second corrector lens; we cannot use the detector because it doesn’t receive light directly from any scatter points. Note: the size parameter defines the radius of the target sphere. This is intentionally set slightly larger than the primary mirror aperture to ensure all rays are included that hit the detector. We will leave the subtended solid angle limit to the default value. Enter data in the Scatter To tab as shown.


Scatter To tab settings


After performing a ray trace, we get the following detector statistics.


Detector with importance sampling


Using importance sampling we achieve over twice as many rays on the detector and we can also see more structure to the scatter intensity.

Now that we have measured the power reaching the detector, we could determine whether further measures are needed to stifle stray light. If the signal to noise ratio was still high enough to suit our purposes, we may decide to avoid the time and cost of implementing baffles in the telescope. If it is determined that further noise suppression is required to meet the system specifications, baffles might need to be instituted.


Was this article helpful?
4 out of 4 found this helpful



Article is closed for comments.