Using an image as a source

This knowledge base article describes how to use a bitmap image as an emitter in FRED using the Detailed Source construct. An example system is included that demonstrates a bitmap source being imaged by an ideal 1:1 relay lens.

Source Setup
The bitmap image to be turned into an emitting source is shown below.

Start by creating a detailed source model:
  • Right mouse click on the Optical Sources folder of our object tree and select “Create New Detailed Optical Source”. On the Positions/Directions tab, set the type to “Bitmap (points specified by bitmap pixels)” and load in the bitmap file. Though not required, the semi-width and semi-height are set to match the aspect ratio of the pixel counts in the bitmap.

The ray directions specification is dependent on your particular application, but this example uses the type “Random Directions into an angular range”. This direction specification allows you to generically direct the rays towards our relay lens, but is not a requirement for setting up a bitmap source.

When a bitmap is used as a source emitter, the algorithm takes the following steps for each pixel in the image:
  1. The designated number of rays/pixel have their positions randomized within each pixel.
  2. The chromaticity coordinates of the bitmap pixel are calculated.
  3. The wavelengths in each pixel have their weights solved to match the chromaticity coordinates from (2).
  4. Each ray’s solved weight from (3) is multiplied by the weight factor specified on the Wavelength tab of the source.
Step 1 is handled by the Rays/Pixel setting of the ray positions specification and step 2 is handled automatically by FRED when the rays are generated. Step 3  is addressed by setting the wavelengths on the source’s Wavelengths tab. If the source is created with fewer than 3 wavelengths, then the pixel’s Y-tristimulus value is used to set the weights in step 3. If the source has 3 or more wavelengths, then a color synthesis optimization is performed internally to get a set of weights the recover the chromaticity coordinates for each pixel.
  • On the Wavelengths tab of the Detailed Source dialog box, right mouse click in the wavelengths list and choose “Set Standard Bitmap Wavelengths”.

Set the draw colors for the wavelengths to be blue, green and red.
  • Right mouse click in the wavelengths list again, and choose, “Set All Colors From Wavelengths”
Note that in Step 4 above, the color synthesized weights are multiplied by the weighting in the wavelengths list. Typically, we don’t want this double apodization of the ray’s weights and we make sure that the weights are all set to 1. The final Wavelengths tab configuration is shown below.

Running the Example File

  1. Open the dialog for the source model by double clicking on the BitmapEmitter source node on the tree.
  2. Click on the Positions/Directions tab.
  3. Use the Select button in ray positions specification to load the Photon.jpg file.  Make sure that the rays/pixel specification is set to 1.
  4. Click on the OK button to commit the changes.
  5. Select Raytrace > Trace and Render from the menu to perform the raytrace. Visualize the rays in the 3D view (note, performing a Trace All Sources will be faster than the Trace and Render option).
  6. Select Analyses > Color Image to view the re-imaged bitmap source at a magnification of -1.

Associated Files:



Still need help? Contact Us Contact Us