Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
TracePro_User_Manual_5.0.pdf
Источник:
Скачиваний:
281
Добавлен:
03.05.2015
Размер:
6.09 Mб
Скачать

Technical Reference

fashion. In stray light problems, the improvement in convergence may be a factor of 1e10 to 1e20. These problems are completely hopeless without variance reduction.

The ability to turn Ray Splitting OFF was implemented for those rare cases in which even simple ray splitting results in a bushy “ray tree” and prodigious memory usage. With Ray Splitting OFF, TracePro uses the Surface Property components (specular R and T, scattered R and T) as the probability of a ray having 1 of those 4 outcomes, and generates one new ray with flux equal to that of the incident ray less any absorption at the surface. Ray Splitting OFF is the nearest thing in TracePro to a crude Monte Carlo raytrace. However, in TracePro with Ray Splitting OFF, a portion of the flux of each ray is absorbed, so each ray may decrease in flux as it propagates. This variation from Crude Monte Carlo was implemented because it reduces the variance without any extra memory usage.

In summary, it is recommended that Ray Splitting be left ON, that raytrace time be controlled through the Flux Threshold and the number of starting rays, and that the convergence be monitored by reviewing the Lost Flux column of the Flux Report. The Ray Splitting OFF option is reserved only for those cases when good results cannot be obtained with ray splitting on.

Importance Sampling Standard Expert

Importance sampling is a Monte Carlo technique in which rays are generated and propagated in specific directions in the optical system, which are “important” in determining the results you need. This improves sampling by increasing the number of rays reaching the surface or surfaces of interest to the user.

Importance sampling is essential in a stray light analysis, where the attenuation of incident light can be very great, and can be helpful in other types of analyses. In a stray light analysis, there should be an importance sampling target for each optical surface in the optical system.

It is important to remember that importance sampling is used only to enhance the sampling of scattered and diffracted light or surface sources. Designs that include only specular reflection and transmission cannot take advantage of importance sampling — the direction of the rays is determined by the Law of Reflection and Snell’s Law.

Figure 7.1 on page 7.3 illustrates importance sampling for the simple case of a lens that scatters from its second surface. A second object is shown that corresponds to a detector. In this case rays from an off-axis field position are imaged such that all of the specular rays miss the detector. Generally, scattering is stronger close to the specular direction of the un-scattered ray so the probability of a randomly scattered ray hitting the detector is very small. When an importance target is applied, it guarantees that the one or more importance rays will hit the detector for each incident ray. Since the flux in the importance ray is scaled by the solid angle and the scattering distribution, a “real” answer is simulated with the fewest actual rays traced.

7.2

TracePro 5.0 User’s Manual

Importance Sampling

random rays

specular rays

importance rays

FIGURE 7.1 - Lens shows specular, scatter, and importance rays

Importance Sampling and Random Rays

In the absence of importance sampling, TracePro generates rays in random directions to simulate scattering. If you are simulating a problem in which light is greatly attenuated, for example, stray light analysis, very little light or even none at all reaches the surface you are concerned about. For example, if you are trying to determine the likelihood of stray light reaching the detector from a source far outside the field of view of an optical system with good stray light attenuation, you

might have to trace a very large number of rays (1010, 1020 or more) to get even one ray to strike the detector. Importance sampling provides a way of increasing the rate of occurrence in the simulation of physically unlikely events, while still getting the right answer in the end. Importance sampling increases the probability of events occurring that are important to you.

Importance sampling affects the tracing of scattered and diffracted rays. When a ray strikes a surface with scattering and with importance sampling, the scattered split ray component is further split into a randomly scattered component and an importance sampled component. The direction of the importance sampled component is determined by aiming the ray at an importance sampling target. In principle, the flux given to the ray component is determined by calculating the integral of the BSDF over the solid angle subtended by the importance sampling target as seen from the intersection point on the scattering surface, and multiplying by the incident flux,

Φimportant = Φincident BSDF(Ω)cosθdΩ.

(7.1)

ΔΩ

 

In practice, the integral is approximated by evaluating the BSDF at the ray

 

direction and multiplying by the solid angle subtended by the target,

 

Φimportant ≈ Φincident BSDFΩ cosθ ΔΩ.

(7.2)

This approximation means that the flux of some importance-sampled rays is underestimated and others are overestimated. To yield the correct result, it is necessary to average the flux of a large number of rays. The flux of the

TracePro 5.0 User’s Manual

7.3

Technical Reference

importance-sampled ray is subtracted from the total allocated for scattering. The remainder of the flux is given to the randomly-scattered component. The direction of the random component is chosen randomly, weighted by the BSDF. TracePro checks the direction of the ray to be sure that it does not intersect the importance sampling target. If it does intersect the importance sampling target, another random direction is chosen and the check performed again. This process repeats until a valid ray direction is found or until a specified threshold is exceeded. If the threshold is exceeded, the random ray component is discarded.

When Do I Need Importance Sampling?

Use importance sampling for:

1.Stray light analysis

2.A non-imaging analysis involving scattering, especially when the collecting area is relatively small

3.A surface source, when you want a large number of rays to be sampled in a particular narrow direction

A good way to decide whether or not to use importance sampling is the following: you usually want to have good sampling at the source and at the exit surface. The fineness of sampling (the number of rays) you need over the source and the exit surface depends on the specific simulation you are doing. In some cases, the source is well-represented by only a few rays (tens or hundreds); in other cases, many rays (thousands or millions) can be required.

The same is true for the exit surface. You directly control the sampling at the source by choosing the number of starting rays and the type of ray distribution. You indirectly control the number of rays at the exit surface for each starting ray by using importance sampling. The more rays you start, the longer the simulation takes to complete. Use of importance sampling increases the exit sampling and the execution time as well, but produces many more samples at the surface of interest. Proper use of importance sampling lets you get sampling at the surface of interest with far fewer starting rays.

If the goal of your simulation is to predict the irradiance with fine spatial resolution, you need a great many rays at the exit surface. You find that, due to the statistical nature of the Monte Carlo technique, the irradiance distribution is noisy, just as in a measurement of light with insufficient source intensity or insufficient integration time. To improve the signal-to-noise ratio, you need to get more ray components to the exit surface, just as in a measurement you might use a stronger source and/ or a longer integration time. You can get more ray components by starting more rays and/or by increasing the importance sampling.

How to Choose Importance Sampling Targets

The objective of importance sampling is to increase the probability of rays going along paths that are important to you. A rule of thumb is to obtain a probability of 1 (certainty) of a ray component reaching the surface of interest for each ray started. For stray light analysis of optical systems with good stray light suppression capabilities, this is a challenge. The optimal selection of importance sampling is a matter of judgment, but several guidelines are given below. At a minimum, however, importance sampling has to be defined for every optical surface in a system when doing a stray light analysis.

7.4

TracePro 5.0 User’s Manual

Importance Sampling

Importance Sampling Example

First, consider what happens if there is no importance sampling. Rays are scattered and diffracted at each surface using the BSDF of that surface as a probability distribution for ray directions. What if a ray enters an optical system, strikes a sunshade as shown below, and the sunshade is coated with flat black (Lambertian) paint?

FIGURE 7.2 - No Importance Sampling

A ray component randomly scattered from this surface has a distribution probability equal to:

-------dP

=

-----------cosθ.

(7.3)

dΩ

 

π

 

The probability of a ray going toward the lens is the integral of the probability density over the solid angle subtended by the lens as viewed from the ray intersection point on the sunshade. Suppose the lens has a radius Rlens = 1 and

the ray strikes the sunshade a distance d = 2 away from the lens and leaves the sunshade at an angle of 60 degrees. Then the probability of the ray striking the lens is approximately:

p1

=

cosθ

 

πR2lens

1

(7.4)

-----------π

----------------d2

= -- .

 

 

 

8

 

Now suppose the lens has a typical BSDF for a polished surface, that is, sharply peaked in the specular direction. For example, let the BSDF for the direction of scattering toward the detector be:

fs 3 × 10–7 sin2 θ .

(7.5)

TracePro 5.0 User’s Manual

7.5

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]