Usually in ZEMAX we work with parametric models of surfaces and objects, so that (for example) a radius of curvature defines the surface of a lens at any point on its surface. This is both compact and easy to optimize.
A 'freeform' surface by distinction is often defined by points on the surface. A curve-fitting routine fits these points to some function, and then the function is used to define the surface height at all points on the surface. So rather than define the coefficients of a function that yield a surface, we define the points on a surface that yield the coefficients of the polynomial.
The functions used to fit the input data are usually chosen to be smooth functions, such as cubic splines, Bezier curves, or NURBS. The Freeform-Z non-sequential object is formed by drawing a cubic spline curve through a series of points in the YZ plane, and then sweeping this curve around the Z axis to form either a solid volume or shell. Cubic splines are formed by a piece-wise concatenation of curved segments. Within the bounds of each segment, the curve is defined by a third order polynomial. The polynomial coefficients describing each segment are determined from the sag values of the defined segment boundaries. The determination of the coefficients is driven by the boundary requirements that the curve goes through the defined points, and both the first and second derivatives be continuous across segment boundaries.
For a third order spline, it is not possible to require higher order derivatives to be continuous across segment boundaries. For this reason, splines are of limited accuracy and usefulness in high precision (imaging) optical design. Note that fundamental optical properties, such as surface power, are determined by second order derivatives, and basic aberrations such as coma and spherical are controlled by third and fourth order derivatives.
This is, of course, why high order polynomials are commonly used for aberration correction in imaging system design.
However spline shapes can be very useful in non-imaging work, as 'optical power' can be added wherever needed. In the following pages we will design a collimator optic for an Osram LED. The Freeform-z object is used, along with its associated FREZ optimization operand. The two should be used together, as the FREZ operand allows the freeform object to be controlled during optimization at any point on its surface, and not just at the points where the defining data exists.
The file 'starting point.zmx' (which is provided as a ZAR file at the end of this article) shows an OSRAM LB_T67_C LED emitting light into a simple 4 mm wide, 40 mm long lightpipe produced by the Freeform-Z object:

Our goal is to produce a collimated beam from this LED. The LED is modeled using a CAD object and source datafile provided by Osram. We use the 100k ray source file in this case. As the CAD object used does not affect the ray-tracing and is for display only, it is omitted from the other examples to reduce download size.
The lightpipe is modeled by a Freeform-z object. This object is defined by a number of points, which can be between 5 and 124. We recommend that you always use the minimum number of points needed, and add further points as the design progresses, if necessary. This is discussed later in the article.
Note that the detector object uses pickup solves on its z-location and x, y aperture size, and that these lock the detector relative to the end of the Freeform-z object. This is one of the key benefits of the NSC editor, in that relationships between multiple objects can be easily defined.
The merit function for this design is simple, and consists of three major sections. The first section simply clears the detector and traces rays. Then the second section computes the desired optical performance of the system. This consists of two goals: the first is that the RMS angular radius be as small as possible (best collimation) and the second is that the total power on the detector be as high as possible. We are therefore balancing best collimation with maximum efficiency.
The third section uses the FREZ operand to constrain the lightpipe shape. With most parametric objects, it is adequate to control the optimization by defining limits on the parameters using NPGT and NPLT (non-sequential parameter greater than, less than) operands. However, because freeform surfaces are formed by fits to the defined data points, it is possible for the fitted surface to deviate strongly at points away from the control points. The FREZ operand allows control of the shape of the object at all points on the surafce, not just the specified control points, and this provides stable optimization without multiple turning points ("ringing") between the defining data.
The Freeform-z object allows up to 124 (y, z) data points along its length, and there is no requirement for these to be equi-spaced. This means that the control points can be optimized in z as well as y, so the control points can move to where they do most good. In order to provide smooth optimization, FREZ can be used to control:
In this example, we use the FREZ operand to constrain the overall length of the pipe, and to prevent it becoming too thick or too thin.
The starting design has the following optical performance:
- peak brightness = .48 lm/sr
- RMS angular radius = 49 degrees
- total received power = .99 lm.










