How to simulate atmospheric scattering using a Mie model

This article describes the implementation of the DLL Mie scattering model in OpticStudio. An example of using this model to simulate scattering in the atmosphere is provided. The sample system consists of two configurations. Configuration 1 models the Rayleigh limit where scattering is mainly due to water droplets in the atmosphere. Configuration 2 models scattering from much larger particles which shifts scattering from the Rayleigh limit to the Mie domain.

Authored By Sanjay Gangadhara


Article Attachments


Mie theory describes the analytic solution to Maxwell’s equations for light scattering from spherical particles. The theory allows arbitrary particle size, which makes it applicable to all radius-to-wavelength ratios. It is useful in modeling atmospheric scattering in clouds1 and may also be used to describe the appearance of common materials such as milk and biological tissue. The model is implemented in OpticStudio as a bulk scattering distribution in Non-Sequential mode. The computation is based on the results provided in the text by Bohren & Huffman.2 

This article provides a description of the model inputs and an example of using the Mie code to model atmospheric scattering.

Code inputs

To apply the Mie scattering distribution to a volume in Non-Sequential mode, open the Object Properties, and under Volume Physics...DLL Defined Scattering, select DLL: MIE.DLL.

object properties dialog

This DLL requires 5 inputs, described below. 

Particle index

This is the (real) refractive index of the scattering particles. The refractive index of the background medium, i.e. the medium in which the particles are located, is determined by what is specified in the “Material” column for the volume. If the particle index matches the background medium index (i.e. if the difference in indices is less than 10-6), then no scattering takes place, since in this case the particles are indistinct from the background. If the particle index is set to be ≤ 0.0, then no scattering takes place (the DLL is ignored).

Size (microns)

This is the radius (r) of the spherical particles. If the value is set to be <= 0.0, then no scattering takes place (the DLL is ignored). The maximum allowable value for the size is based on the maximum allowable value for the normalized sphere size (x = 2πrnbackground/λ), which is currently set to be 1934. If the normalized sphere size exceeds 1934, then no scattering takes place; for such large spheres, it may be more appropriate to model the spheres themselves in OpticStudio, rather modeling the effective scattering distribution which results from the spheres.

Density (cm-3) and Mean Path

The density (ns) of scattering particles in the volume. If this value is set to be < 0.0, then no scattering takes place (the DLL is ignored). If this value is set to be > 0.0, then this value is used – along with the scattering cross-section (σs) calculated by the code– to determine the mean-free path for scattering in the volume λmfp = 1/nsσs. If the density is set to be = 0.0, then the mean-free path for scattering in the volume will be equal to the value specified in the “Mean Path” parameter entry. When the density is > 0.0, the value specified in the “Mean Path” parameter entry is ignored. On the other hand if the "Mean Path" parameter value is = 0.0, the DLL will be ignored. Also note that you cannot enter a negative value for "Mean Path" in this dialog.

Min. thresh. 

The scattering calculation in OpticStudio involves integration of the probability distribution function (more details are provided in the article, "How to create a user-defined scattering function"). The integral is usually taken from 0 to π in the polar direction (and from 0 to 2π in the azimuthal direction). However, for a peaked distribution, it is computationally inefficient to perform this integral over regions of angle space in which the probability is zero. The minimum threshold value allows the user to define a smaller upper limit for the polar integral. The upper limit is determined by the location in polar angle space at which the probability distribution is equal to a small fraction of the peak of the distribution; the fraction is equal to the minimum threshold value. For example, if the minimum threshold value is set equal to 0.01, then the upper limit for the polar integral will be the location at which the probability distribution is equal to 0.01 times the peak probability. If the input value is set to be ≤ 0.0 or ≥ 0.5, a default value of 0.001 is used.

It is important to be careful when specifying this value. In general, the probability distribution for larger particles is more peaked, so it may be tempting to set the minimum threshold to a larger value. However, the angular resolution of the scattering calculations is fixed (0.1 degrees), and thus as the probability distribution becomes more peaked, the drop-off in probability from one angle to the next is steep. Therefore, to ensure that enough data points are used in the integration, it is generally necessary to decrease the minimum threshold value in this case.

The best way to determine the appropriate value for this parameter is to compare the results as this parameter is varied. Start with a value of 0.01 and then reduce the value by a factor of 10. If the results change significantly, continue reducing the value until the results converge. Beyond this point, any more reduction in the value simply increases computation time without increasing computation accuracy.


This is an attenuation factor which reduces the intensity for any ray which undergoes a scattering event. When a ray is scattered inside the scattering volume, its intensity is multiplied by this factor. For example, if the Transmission is set 0.89, the scattered ray will have the intensity that is 0.89 times of its intensity before scattered. This factor allows the user to account for absorption of energy in the scattering sphere. Absorption of energy in the background medium will be determined by the Transmission properties for the material specified in the “Material” column of the volume (as described in the article, "Fitting index data in OpticStudio").

Although the imaginary component of the refractive index for the scattering particles affects absorption – which can be characterized by the Transmission input to the DLL – this component can also affect the probability distribution for scattering. However, the probability distribution is only affected if the magnitude of the imaginary component is ~10-2 or larger, which corresponds to highly absorbing particles. Thus, the effect of the imaginary component on the scattering distribution is neglected in the Mie model presented here.

Additional considerations

Finally, the “Angle” parameter is not used by the DLL. However, if value set for the “Angle” parameter is ≤ 0.0 or > 180.0, then no scattering takes place (the DLL is ignored).

The Mie scattering distribution is characterized by two dimensionless parameters: the ratio of the refractive indices for the scattering particle and the background medium (m =nparticle /nbackground) and the normalized sphere size (x =2πrnbackground/λ). Separate calculations of the Mie distribution must be performed for each (m, x) pair, but once these calculations are complete the results are stored in memory and can be used to trace any number of rays. Data for up to 10,000 pairs of (m, x) values can be stored in memory by the DLL. Once this limit is exceeded, no more Mie data can be stored, and no scattering will occur for any subsequent (m, x) pairs. For almost all applications of interest, the limit of 10,000 pairs is more than sufficient.

Example: scattering in the atmosphere

We will now explore a simple example to illustrate use of the Mie code. This example is availble for download in the Article Attachments, located at the top of this article.

In this example, a Source Ellipse is used to model emission from the sun. The spectral distribution of this source is determined by its black body temperature (for more details, see the article, "How to model colored and Tristimulus sources"). 


A temperature of 5780 K was chosen as representative of the Sun’s surface.3

A Rectangular Volume object is used to simulate the atmosphere, and the observed color of the atmosphere is determined using a Detector Color object (for more details, see the article, "How to measure and optimize color data"). Another Detector Color object is used to provide the observed color of the Sun’s spectrum. Note that this basic example is not to scale, but simply intended to illustrate use of the Mie code for such a system.

The system is defined in two configurations. In Configuration 1, the parameter inputs to the Mie DLL are specified such that the model represents the Rayleigh limit for scattering (normalized sphere size << 1).


A particle index of 1.33 is used, corresponding to the index of refraction of water. The material specified for the Rectangular Volume object is blank, i.e. the volume is made of air. Thus, this model represents scattering from water droplets in air.

The size of each droplet is 7 nm. For visible wavelengths (λ between 0.4 and 0.7 μm), the normalized sphere size is therefore between 0.063 and 0.11 (<< 1, corresponding to the Rayleigh limit). The particle density is defined to provide a scattering mean-free path of approximately a few mm for this system (this data is not reported by the DLL, but was determined by internal probing of the code).

Tracing 10 million rays in this system, we find that the resulting color of the atmosphere is blue, which results from the strong (1/λ4) wavelength dependence of scattering in the Rayleigh limit (see the article, "Bulk scattering with the Rayleigh model," for more details). 


The color can be characterized by its chromaticity coordinates, using the NSDE operand in the merit function.


Comparing these values to those generated for the solar spectrum (shown by lines 7 and 8 in the merit function), we can clearly see the shift in the color that occurs in the limit of Rayleigh scattering.

In Configuration 2, the size of the scattering particles is significantly increased, to bring the system from the Rayleigh limit to the Mie domain:


The particle density has been reduced, to maintain the scattering mean-free path at about a few μm, as in Configuration 1. It should be noted that this data is not reported by the DLL, but was determined by internal probing of the code. The minimum threshold value has been reduced as well, to ensure that the probability distribution is adequately sampled in this large-particle limit. Tracing 10 million rays in this configuration, we find that the color of the emission is nearly identical to that of the source spectrum.


This result is quantitatively confirmed using the NSDE operand:


The results indicate that the scattering distribution has little wavelength dependence in the Mie domain, consistent with descriptions provided in the literature.4 These results explain why light near the Sun looks white (i.e. the same color as the Sun). The results also explain why clouds look white: the water droplets which make up clouds are much larger than the molecules which make up the atmosphere (these molecules were modeled as water for this simple example, but in reality would made up of nitrogen and oxygen), so the observed color does not shift when sunlight is scattered in clouds but does shift when this light is scattered in the atmosphere.


  1. Wikipedia. 2019. Mie scattering. Feb 6.
  2. Bohren, Craig F.; Huffman, Donald R. 1983. "Absorption and Scattering of Light by Small Particles." p. 82-129, 477-482. John Wiley & Sons.
  3. Wikipedia. 2019. Sun. Feb 4.
  4. Nave, Carl R. 2017. Blue Sky.


Was this article helpful?
9 out of 11 found this helpful



Please sign in to leave a comment.