# How to apply scattering in the presence of total internal reflection (TIR)

In this article, we will show how to utilize a dummy surface in order to model an object that exhibits total internal reflection (TIR) while also maintaining other unique surface properties, such as a rough surface structure.

Authored By Erin Elliott & Alissa Wilczynski

Article Attachments

## Introduction

In OpticStudio, total internal reflection (TIR) is applied at a surface before other surface properties, such as scattering. This can cause a problem when attempting to model light pipes or fibers that include optically rough surfaces. Such elements rely on TIR, but don’t achieve perfect TIR behavior due to the surface roughness. To correctly model such systems, an embedded surface can be used so that the scatter function is applied before the TIR.

## The problem

Consider the attached file, “ScatteringAndTIR_TIRAppliedBeforeScatterFunction.zar.” It contains a PMMA cylinder that is 10 mm in diameter and 50 mm in length. The Lens Data Editor is shown in the figures below. Line 1 contains a source that launches rays at 15°. Lines 4 and 5 place detector rectangles just inside and just outside the surface of the cylinder. We have made a light pipe using a Cylinder Volume object. The pipe has a diameter of 10 mm and a length of 50 mm.

The Non-Sequential Shaded Model shows the rays incident on the bottom surface of the cylinder. The rays do not undergo any scattering and through TIR are reflected back into the cylinder.

Note that “Color Rays By:” has been set to “Segment #.” This changes the color of the rays each time they interact with an object. Note that “Scatter NSC Rays” is also checked.

Now, suppose that the cylinder has a rough or ground surface that we want to model with a Scatter function. So a “Lambertian” scattering function is added to the side faces of the cylinder in the Object Properties, like this:

The new Shaded Model plot is shown below. When the TIR is applied before the scatter function, the reflected rays (shown in green) are scattered, but the rays are all scattered into the cylinder. In reality, at a rough surface, rays would scatter out of the cylinder, too.

As a ray intersects the cylinder, there are two calculations that take place within OpticStudio. First, the software calculates the specular ray path according to Snell’s law. Next, the scatter function is applied to deviate the rays from the specular path. The result is that all rays are scattered internally at the interface, with no possibility for the rays to scatter outside the pipe.

The output on the detectors - one just inside and one just outside the cylinder - also show that none of the incident rays are scattered out of the cylinder on the first reflection. Rays only leave the cylinder after subsequent bounces, producing a uniform low-level illumination on the second detector, rather than the bright spot we would expect from a rough surface.

Below, the detector on the left shows the concentrated beam from within the light pipe. The detector on the right shows a diffuse beam, indicating that rays only leave the light pipe after multiple bounces.

## The solution

The solution to this problem is to embed a dummy surface just inside the Cylinder Volume, and apply the scattering function to that surface, instead. This forces the software to apply the scattering function before the TIR, because the rays encounter the scattering surface before they encounter the air-glass interface where Snell’s Law is computed.

In the attached example, “ScatteringAndTIR_EmbeddedScatterSurface.zar,” Line 3 of the Non-Sequential Component Editor is a Cylinder Pipe object, as shown below. The object has no material defined, so without a scattering function, Snell’s Law produces no deviation of the rays at the surface of the Cylinder Pipe. In this case, the radius of the Cylinder Pipe is set to 4.98 mm, or 20 um smaller than the Cylinder Volume that defines the light pipe. The scattering function is placed on the Cylinder Pipe, instead of on the Cylinder Volume itself.

The new 3D Layout plot is shown below. Rays are now scattered out of the cylinder as well as back into the cylinder. And the detectors inside an outside the detector now show similar distributions.

KA-01340