# Source Importance Sampling

## Introduction

Setting up a source as a lambertian emitter can be easily done in FRED using the Detailed Source model but often ends up being inefficient for raytracing because the collection optics subtend a small solid angle compared to the emission of the source. Often, however, we can take advantage of FRED’s surface scattering property to efficiently direct rays from a source to a collector. The purpose of this knowledge base article is to describe the procedure for setting up a Lambertian source which uses surface scattering to efficiently direct rays into an optical system.

## Example System

For the purpose of this article, we will be describing the technique for setting up the source in the context of the model shown below. The completed model is provided at the end of the description.

We have an annular geometry which should be radiating with a Lambertian distribution. Off-axis, there is a collection optic and a receiver surface. The goal will be to setup a Lambertian source which generates rays efficiently to the collection optic.

## Surface Scatter

Why would we want to incorporate FRED’s surface scatter feature into a source definition? Well, the answer is simple efficiency. When a surface is setup to generate scatter rays the user gets to choose something called the Scatter Direction Region(s) of Interest. By definition, scatter distributions will generate a set of rays which are directed into a full hemisphere about the surface normal. However, we are usually only interested in a particular direction of the hemisphere. Scatter Direction Region(s) of Interest (or more commonly, “Importance Samples”) allow the user to tell FRED in advance which particular direction you are interested in. When the scattered rays are generated at the surface interaction, they will be directed towards the region of interest (all of the radiometry is handled for you, of course). Consider the example below where we have a simple scattering surface and a small target plane. On the left we show the case where we allow 10,000 rays to scatter from our surface into the default hemisphere. Of the 10,000 rays, only 23 hit the target! In the second case we setup the scattering surface with importance sampling towards our receiver plane. Of the 10,00 rays, 9,997 hit the target!

So, let’s take advantage of the surface scatter importance sampling in setting up our source so that we can efficiently get rays from the source to our collection optics.

## Source Setup

Now that we have established what importance sampling is, let’s incorporate it into our source model. First of all, we are going to use the annulus surface in our example model to define the source emission area. The idea will be to generate a set of rays over the area of our annulus surface and let them scatter Lambertian off the surface so that the scatter importance sampling directs the resulting rays towards our collector. We start by defining a Lambertian scatter model appropriate for our setup. On the Scatterers folder of the object tree, right mouse click and select “Create a New Scatterer”. We want to create a new scatter model with the following specifications:

Next, we open the dialog for our annulus surface and on the Scatter tab we apply our new “Lambertian100R” scatter model. On the same Scatter tab, in the “Scatter Direction Region(s) of Interest” area, we deactivate the “Default” importance sample and press the “Add New” button. In the importance sample dialog we are going to create the following specification, which tells the surface to generate scattered rays towards the first surface of our collector lens.

After adding our new importance sample specification to the surface, the Scatter tab of our annulus surface should like the following:

Next, we go to the surface’s Coating/RayControl tab and check that the surface will actually allow scattered rays in reflection. To avoid any confusion with your existing raytrace controls we want to create a special purpose control which only allows scattered rays in reflection. In the Raytrace Control portion of the dialog, press the “Create New” button and use the specifications shown below.

After creating the new raytrace control set, apply it to the surface.

At this point, the surface geometry is setup appropriately to handle our custom source. Next, we begin to setup the source itself. Create a new Detailed Optical Source in your optical sources folder and go to the Positions/Directions tab of the dialog. For the Ray Positions specification, choose “Random Surface (random points on a designated surface)”. We want the ray positions to start at our annulus geometry and we ultimately want to scatter these source rays from the annulus surface into our optical system. So, we use the following specifications:

Setting up the source with this positions specification starts the rays on the area of the geometry, offsets them slightly along the local surface normal and then runs them into the scattering surface once you perform a raytrace.

The effect of this source setup is that, as intended, we have an annular extent source emitting a Lambertian ray distribution efficiently at the collector optic.

## Summary

This article has demonstrated a technique for efficiently generating a Lambertian source which targets a specific region of space. In addition, the source aperture shape can be uniquely specified by the scattering surface geometry as well