Modeling surface scattering is important in many optical systems and is critical for stray light analysis. ZEMAX has several built-in scatter models with flexibility to encompass nearly any scattering profile.
Accurate modeling of surface scatter in non-sequential ray tracing can require a large number of rays to strike a desired object in order to properly model the scatter profile. This problem is exacerbated if the desired target subtends a small solid angle from the scatter point. The solution to this problem is to increase the number of incident and/or scattered rays so that more rays will strike the desired target. Of course, tracing more rays takes more time, and thus modeling scatter can be a lengthy process.
ZEMAX allows use of a “Scatter To” list to improve scattering efficiency, whereby scattered rays are only traced if they intersect some desired object(s). This doesn’t guarantee that scattered rays will hit an object, so the number of rays needed for accurate results could still be quite large.
ZEMAX now has “Importance Sampling” to drastically improve scatter efficiency. Both features can be found in the “Scatter To” tab in the object properties dialog. 
Importance sampling is fundamentally different than Scatter to. If an object is listed in the importance sampling list, ZEMAX will always scatter rays towards a target sphere centered at this object. To account for the scatter profile, ZEMAX 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. 
When importance sampling is enabled, however, numerous rays strike the detector.
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 ZEMAX 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. ZEMAX 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 ZEMAX would choose for importance sampled rays (horizontal red bar).
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.
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.
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” found on the last page of this article. 
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.
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.
After performing a ray trace, we get the following detector statistics.
Using importance sampling we achieve over twice as many rays on the detector and we can also see more structure to the scatter intensity. The total power at the detector has also increased indicating that our previous scatter model was under-sampled.
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.
ZEMAX has an importance sampling feature that improves scattering efficiency. By always scattering rays towards object(s) of interest, the signal to noise ratio of the energy registered at the object is increased.