November 24, 2020

# Using the TrueFreeForm surface for grid-based freeform optimization

The TrueFreeForm surface is a sequential surface type in OpticStudio which uses a superposed combination of polynomial and grid-based sag characterizations. In addition, the TrueFreeForm surface also supports optimization of the sag values at each data point in the grid sag data file, allowing for a unique, non-parameterized optimization methodology. This can be advantageous in cases where spatially-selective optimization is desired, or a given polynomial function cannot well represent the desired sag structure.

TrueFreeForm allows surface sag to be defined using polynomial functions including biconic toroidal, even asphere, Zernike standard polynomial, and extended polynomial, as well as a grid-based sag definition. There are several advantages to having access to all these sag functions within the same surface. For instance, freeform surfaces optimized using extended polynomial, biconic toroidal, or grid-based definitions can now be externally toleranced for irregularity via Zernike coefficients. Perhaps the most interesting advantage of TrueFreeForm is the ability to optimize the sag profile through setting points in the sag grid as variables.

Grid-based sag optimization has some interesting advantages over traditional parametric (polynomial function-based) optimization. Because the default grid sag interpolation algorithm used is a bicubic spline method, the domain of influence of any individual point in the sag grid extends only two points away. This means that if we optimize the sag of just one point in the data grid, only the local surface structure is affected, and the distant surface structure is perfectly preserved. This is demonstrated in the following figure, where a 1D spline model is shown for simplicity The three curves are defined via cubic spline between 5 points. The leftmost point varies between the three curves, and the effect only extends two points away.

Considering the full 2D grid of sag values which are used to define a surface structure, this means that by optimizing the sag at a single point (shown in red below), we only affect the surface structure within a rectangular region of 5x5 points.

This brings two revelations. Firstly, with grid sag optimization, we can optimize sub-regions of a given surface, whereas with parametric optimization we necessarily alter the entire surface structure with any change to a parameter value. Secondly, we can generate unique surface geometries, which might be very difficult or impossible with a given limited-order polynomial function.

There are two main considerations to be aware of when using the grid-based optimization approach. Because the sag grid utilizes cubic interpolation, this means that the curve defined between a set of points might be limited in the geometric form it can achieve. Additionally, there is a fine balance in the optimal density of sag points to define in the data grid; too many, and the optimization can become slowed down (too many variables), and sampling becomes an issue (see below). Too few data points, and the optimization might not be able to achieve an optimal surface structure. Care and consideration must be used when definition the data grid to be used with this optimization method.

OpticStudio’s TrueFreeForm model provides newfound flexibility, both in the combination of multiple freeform sag definitions, and in the ability to optimize surface sag profile in a grid-based approach.