How to design a Gaussian to Top Hat beam shaper

This article demonstrates how to design a refractive beam shaper that converts a Gaussian intensity profile into a Top Hat profile.

Authored By Nam-Hyong Kim, Updated by Alissa Wilczynski


Article Attachments


Beam shaping optics transform input intensity distributions into some desired output distribution. Generally, it is the case that the input beam is easy or cheaper to generate, whereas the output is more complex. A common example is to take the Gaussian irradiance distribution produced by a laser and transform it to a Top Hat(flat top) output for use in cutting, laser patterning, and more.

This type of system can be modelled in OpticStudio. We will start by optimizing the sag of the lens by using geometrical ray targets in the Merit Function. In this approach, we compute where in the output plane a given input ray should land, and express this through ray targets entered into the Merit Function Editor.

System definition

The diagram below represents the system we are trying to replicate. This system has an output Top Hat beam of K radius and input Gaussian beam of W waist.

Output_K radius_input_W_waist

First, we need to determine analytically the output radial distance S for a given input coordinate X such that the encircled energy B at the output is the same as the encircled energy A at the input.

Analytical treatment

Our desired output profile is a uniform distribution of maximum extent K from an input Gaussian of 1/e2 width W. The input distribution has irradiance Pexp{-(2R2/W2)} and the output distribution is a step-function of irradiance H and maximum radial width K:

Input encircled energy A:


Output encircled energy B:


Solving for A using substitution:



Since the two encircled energies are equal, A = B, and:



Also, we know that the total input and output powers are equal, therefore:



Substituting this for the above equation for S2, we get:


Now that we can calculate the output coordinate value S for every input coordinate X, we can use the REAY optimization operand to specify an array of input ray coordinates and their respective output target values in the Merit Function Editor. In the REAY operands, we will specify the normalized input coordinates and the corresponding targets at the image plane. Instead of inserting the operands manually, we will write a ZPL macro to automatically generate the Merit Function and optimize the lens.

Generating the Merit Function via ZPL macro

The following macro will insert the REAY operands in the Merit Function Editor and will then optimize the system. The macro can be downloaded from the attached ZIP file.

Beam homogenizer

Save the included macro file Beam Homogenizer.ZPL from the last page of the article to your {Zemax}\Macros folder.


Open the included Beam_Homogenizer.ZMX lens file. The sample system is a single plano-convex lens with an Even Aspheric front surface. The variables are radius, conic, and even aspheric coefficients. The system wavelength is 0.623 um (HeNe) and the glass type is N-BK7.


In the main menu, click Macros/Beam Homogenizer. After executing the macro, the layout window will look like this.


Notice that the input ray apodization is Gaussian but the output is uniform. The spacing between the rays at the image surface is very uniform indicating that the irradiance distribution should be close to the ideal Top Hat.

Analysis of results with Geometric Image Analysis

The Geometric Image Analysis feature (Analyze...Extended Scene Analysis...Geometric Image Analysis) shows a Gaussian profile at surface #1 and a Top Hat profile at the image surface.

Geometric Image Analysis

If in the Geometric Image Analysis settings, we increase the number of rays to 500,000 with 200 Pixels, you will get a much better signal-to-noise ratio (shown below). 


signal-to-noise ratio

For other values of input waist W and output radius K, you can change the corresponding variable values in the macro.


Was this article helpful?
3 out of 4 found this helpful



Please sign in to leave a comment.