OpticStudio provides various design tools for common surface structures, scatter profiles, beam definitions, etc. some simulations require custom definitions. The most flexible option for defining custom optical properties is a user-defined DLL. Why Anatoli Trafimuk uses user-defined objects for design our non-imaging optics:

  • They provide a built-in fully integrated, simple solution for efficient design of freeform based illumination system in non-sequential mode.
  • Use simplified Bezier curves (up to 4) to create surfaces and solid objects
  • User-defined objects are an easy way to describe the lenses based on Bezier curves.
  • UDO behaves like a built-in object, has a fast raytrace, and fully integrated into optimization.

What was done by Anatoli Trafimuk:

  • Created 20+ freeform UDO to describe illumination systems natively in Zemax. All DLLs was written with Microsoft Visual Studio software
  • All UDO has parameters for optimization its shape, control the geometry, size, and special features like faceting, fillets, etc.
  • Created a set of ZPL macro which allows scaling the UDO, change their parameters, change surface properties, control the slope, control the shape, and much more.
  • Also, there are several macros to create a direct CNC machine command file for some types of UDO.

To creating UDO in Zemax Anatoli Trafimuk uses Bezier curves. Bezier curve is a parametric curve used in computer graphics and related fields. The curve, which is related to the Bernstein polynomial, is named after Pierre Bezier, who used it in the 1960s for designing curves for the bodywork of Renault cars. Other uses include the design of computer fonts and animation. The curve is simple to use. It controlled by control points set, which are just a set of numbers. Point not lie on the curve except start and end point. This is best to build freeform optical surfaces.

 

The simplified Bezier curve used for creating objects. The feature of that curve representation is that X control points equally spaced along the axis. So we use the only parametrization of the Y part of the curve. This allows us more simple calculations while creating complex objects from those curves. The raytrace for surfaces based on that curve is 30% faster rather than usual Bezier curves and up to 60% faster if use more general NURB representation.

And we remain almost all flexibility of freeform and use fewer variables. The equation of the simplified Bezier curve is the following:

 

 

And its polar form is the following:

 

Some important surfaces created from Bezier curves

  • 3 Surface of revolution of simplified Bezier curve ( TIR)
  • The surface of revolution of simplified Bezier curve along simplified polar Bezier curve ( Type V beam shaping)
  • The surface of the revolution of 4 simplified Bezier curve along a simplified polar Bezier curve. Each independent curve describes the quarter of the 360-degree surface. Curves use the same X parametrization while Y is different.
  • Extrude the simplified Bezier curve along another simplified Bezier curve

To create the UDO we need use 3 steps:

Step 1.  Model surface equations in math software, e.g. free version of MapleV5

 

Step 2: Create C++ code for surface shape and raytracing and compile it into DLL

 

Step 3: Import Dll in Zemax as User Defined Object

 

 Several examples of the most commonly used objects are shown below.

1. TIR lens designed with UDO in Zemax Optics Studio

2. Example of surface of revolution of Bezier curve along the polar Bezier curve:

3. RXI lens designed with UDO in Zemax

4. 130 degree angle uniform rectangle spot lens designed with UDO in Zemax

 5. Type III streetlight lens designed with UDO in Zemax

 

 

6. Type III streetlight lens designed with UDO in Zemax

7. Round Fresnel lens with a freeform curved shape of the tooth base

 

Using User-Defined Object, Macros, and User Defined surface greatly expand Zemax capabilities. And with the use of User-defined sources, scatter functions, and coatings Zemax is the most powerful and flexible optical design software in the world

 

Introduction

Within non-sequential mode Zemax allows us to use different types of objects in design: lenses, aspheres, cylinders, blocs, and others. But sometimes the user can’t find the appropriate object. For this, there is a feature allowing create your own object for advanced users.  

There is “User Definer Object” in the object type list. This object represented by DLL (Dynamic Link Library). It can be written in C programming language (or C++ also). The advantages of these objects as described in [1]:

 

  • DLL defined objects generally ray trace much faster, and with much higher numerical precision, than objects imported from CAD programs.
  • Any number of complex curved shapes may be combined in a single object, unlike the polygon object which only has flat faces.
  • Objects may have a mixture of reflective and refractive curved faces, with user-definable face names.
  • The DLL description is inherently parametric, which means the object is dynamically regenerated when any defining property is modified. This allows interactive design, modification, and even optimization.
  • User-defined coating data, including detailed control over the complex amplitude reflection and transmission coefficients, is supported. Coating data may be ray position, cosine, or object coordinate dependent.

 

Below we’ll consider some sample Zemax DLLs and DLL with a surface of revolution of Bezier curve, also some mathematics for calculating ray-surface intersection.

 

 

Sample Zemax DLLs and implicit surfaces

Most surfaces can be represented in implicit form . For raytrace we must found an intersection point of the ray with the surface, also find normal vector to surface in this point.

We can see two user DLLs with C code in folder \Zemax\Object\Dll\UserObjects - Half cylinder and Elliptical volume. These DLLs creates a solid bodies shown below:

 

 

Each object has flat front and rear surfaces, and user-defined side surface. In DLL first, we must create a set of flat triangular facets for approximating the object. This approximation uses for object drawing and also gives us the starting point for finding a ray-surface intersection point.

 

 

Normal vector  to surface at point  proportional to partial derivatives of  at this point as described in the book [2]. So we have a normal vector . Zemax gives us the following data: point of intersection ray with flat facet  and direction cosines of ray . From us it require distance  from point  to actual surface ray intersection point and normal vector components. Ray equations are , , . Therefore at the intersection point, we must have . In sample DLLs code there is a description of a simple Newton iteration process for finding and normal vector components. Note: vector components must be normalized before sending it to Zemax. Also in sample DLL code other information concerned C language routines and details can be found.

 

 

Bezier DLL and parametric surfaces

Some surfaces can’t be represented in implicit form. But they can be parametric. I.e. each point of these surfaces satisfy equations [3]: , where  - parameters of the surface. Normal vector to surface at point , , is defined by the cross product .

Ray equations are . Here  are ray coordinates at flat triangular facet,  are ray direction cosines. At ray-surface intersection point, we must have , , . So we obtained a system of equations , , and three unknown parameters . If we solve them we will got a distance to the actual surface and normal vector.

For demonstration we choose the revolution surface of Bezier curve as the side surface, front and rear are still flat. Bezier curve is a parametric curve defined by the following equations [4]: , where , . Here  are the control points of the Bezier curve, the total number of points is . With two dimensional curves, we have . For curve revolve we must include parameter v, so the surface of revolution is . Notice that these three equations correct for other curves in general. Revolution surface of Bezier curve and native curve are shown above:

 

          

 

Further, we must solve the system of equations described above. We can use the Newton method described in [5]. Put , where . Then next iteration root is , where -1 power denotes inverse matrix and  detotes jacobian of :

 

.

When , where  is user-defined small number we will have a solution for this system. But pay attention to choosing a starting point for the Newton method. With periodic function, we can have an incorrect result.

 

 

User DLLs and imported objects

User-defined DLL sample for Bezier-based object can be found in the archive at last page of this article. The filename is bezier_r.dll, also C code includes in file bezier_r.c. Note that bezier.dll compiled for SSE2 processor instruction set (CoreDuo or newer processors), if you have older you can compile bezier_r.c for your system yourself. Parameters 1 and 2 specify the facets numbers, parameters from 3 to 22 specify control points data.

Now we create in Zemax Bezier object same as shown above and set 10 radial and 10 angular facets with Source ellipse:

 

 

As we can see rays refract not at facets, but on exact surface geometry. Then if we increase the number of facets picture looks more pretty:

 

 

And we can export user defined objects from Zemax to CAD formats (SAT, STEP or IGES). But pay attention that the resulting file not smooths the surface, but only set of facets. For obtaining exact solid geometry we can use external CAD software, for example, Rhino3D, KOMPAS, AutoCAD, ProEngineer etc. And set Bezier curve points manually, then rotate and export to CAD file or save for future work.

Then we create file bezier_r.sat in CAD software. And run raytrace for DLL object and imported object with 1 million rays (test.zmx and testCAD.zmx files). Also, we will check memory usage. We used AMD 3950X processor for analysis and OpticsStudio 20.3. Results in the table below. There is an amazing raytracing speed!

 

 

DLL

Imported in Kernel mode

Imported in Standard mode

Memory usage, Mb

563

1142

928

Raytrace time, sec

5.1

318

7.78

 

Optimization is possible for user defined objects. We can set control points as variables. Just try to improve focusing properties of our object. See file optimize.zmx. After optimization we have this object, like free-form:

 

Using the custom surface of revolution in Zemax

Such surfaces above could be used for designing freeform lenses like RXI lens, TIR lens, and reflectors with or without facets.

  

Summary and Attachments

We considered Zemax capability – use User Defined Objects and how this object can be realized. It works faster than imported object. We showed the object based on revolution surface of Bezier curve, but each user, who is sophisticated in programming, can describe your own object and optimize it within Zemax.

 

 

 

References

  1. Zemax User’s Guide
  2. A. Korn, T.M. Korn. Mathematical handbook for scientists and engineers, McGraw-Hill, 1968.
  3. Shirley, R. K. Morley. Realistic Ray Tracing 2nd ed., A K Peters, 2003
  4. Piegl, W.Tiller. The NURBS book, Springer, 1996
  5. William H. Press et all., Numerical Recipes. The Art of Scientific Computing 3rd, Cambridge University Press, 2007

Several results of different tasks were published in the following articles:

1. A. V. Pravdivtsev, "Combined effect of an IR optical system’s design and process parameters on the background irradiation on the detector," J. Opt. Technol. 86, 533-538 (2019). 10.1364/JOT.86.000533
2. A.V. Pravdivtsev. The use of annular lenses in wide angle optical systems. European Optical Society Annual Meeting, / Technical digest. 2014.
3. A. V. Pravdivtsev. Ring lenses in wide angle optical systems. Technical digest of 9-th International Conference on Optics-photonics Design & Fabrication. 2014, pp. 159-160. SBN: 978-4-86348-399-6.
4. A.V. Pravdivtsev, M.N. Akram, Simulation and assessment of stray light effects in infrared cameras using non-sequential ray tracing, Infrared Physics & Technology, Vol. 60, Sep. 2013, pp. 306-311.
5. A.V. Pravdivtsev, Prospective use of cooled detectors with integrated optics in conformal multisensors electro-optical systems // Technical Digest of 8th International Conference on Optics-photonics Design & Fabrication, 2012, pp. 79-80. ISBN: 978-4-86348-265-4.
6. A.V. Pravdivtsev, Analysis of the mount construction on the thermal radiation of optical systems, Proc. X Int. Conf. Appl. Optics (2012) 230–234.
7. A.V. Pravdivtsev. An approach to the design of wide-angle optical systems with special illumination and IFOV requirements. // Proc. SPIE 8429, 84291L (2012), DOI: 10.1117/12.922116.
8. A. V. Loparev, E. V. Romash, A. V. Pravdivtsev, P. S. Ignat’ev, K. V. Indukaev, and P. A. Osipov, "Metrologic platform with a modulation interference microscope," J. Opt. Technol. 79, 371-375 (2012).
9. A.V. Pravdivtsev. The lens for chromatic selection of spectral components in the image of ring polychromatic object. // Ivestia VUZov. Priborostroenie, 2012, vol 55, №7, p. 36-42.
10. A.V. Pravdivtsev. About the possibility to design wide angle optical systems with specific requirements to instantaneous field of view. // XXII Int. Conf. Photoelectronics and night Vision. Moscow, 2012. p. 73-75.
11. Makarenko A. V., Pravdivtsev A. V. Architectural solutions of conformal network-centric staring-sensor systems with spherical field of view. // Proc. of SPIE Vol. 8185, 81850I (2011).
12. Makarenko A. V., A.V. Pravdivtsev. Analysis of the mount properties on the thermal radiation of optical systems, Proc. X Int. Conf. Appl. Optics (2010).
13. A.V. Makarenko, A.V. Pravdivtsev, A.N. Udin, The estimation method of internal stray radiation in infrared systems, Elektromagnitnie volni i elektronnie sistemi 12 (2009) 28–37.

 

Welcome to our Privacy Policy

Your privacy is critically important to us.

Custom Optical Design

It is Custom Optical Design's policy to respect your privacy regarding any information we may collect while operating our website. This Privacy Policy applies to https://customopticaldesign.com/ (hereinafter, "us", "we", or "https://customopticaldesign.com/" or "https://www.customopticaldesign.com/"). We respect your privacy and are committed to protecting personally identifiable information you may provide us through the Website. We have adopted this privacy policy ("Privacy Policy") to explain what information may be collected on our Website, how we use this information, and under what circumstances we may disclose the information to third parties. This Privacy Policy applies only to information we collect through the Website and does not apply to our collection of information from other sources.

This Privacy Policy, together with the Terms and conditions posted on our Website, set forth the general rules and policies governing your use of our Website. Depending on your activities when visiting our Website, you may be required to agree to additional terms and conditions.

Website Visitors

Like most website operators, Custom Optical Design collects non-personally-identifying information of the sort that web browsers and servers typically make available, such as the browser type, language preference, referring site, and the date and time of each visitor request. Custom Optical Design's purpose in collecting non-personally identifying information is to better understand how Custom Optical Design's visitors use its website. From time to time, Custom Optical Design may release non-personally-identifying information in the aggregate, e.g., by publishing a report on trends in the usage of its website.

Custom Optical Design also collects potentially personally-identifying information like Internet Protocol (IP) addresses for logged in users and for users leaving comments on https://customopticaldesign.com/ blog posts. Custom Optical Design only discloses logged in user and commenter IP addresses under the same circumstances that it uses and discloses personally-identifying information as described below.

Gathering of Personally-Identifying Information

Certain visitors to Custom Optical Design's websites choose to interact with Custom Optical Design in ways that require Custom Optical Design to gather personally-identifying information. The amount and type of information that Custom Optical Design gathers depends on the nature of the interaction. For example, we ask visitors who sign up for a blog at https://customopticaldesign.com/ to provide a username and email address.

Security

The security of your Personal Information is important to us, but remember that no method of transmission over the Internet, or method of electronic storage is 100% secure. While we strive to use commercially acceptable means to protect your Personal Information, we cannot guarantee its absolute security.

Advertisements

Ads appearing on our website may be delivered to users by advertising partners, who may set cookies. These cookies allow the ad server to recognize your computer each time they send you an online advertisement to compile information about you or others who use your computer. This information allows ad networks to, among other things, deliver targeted advertisements that they believe will be of most interest to you. This Privacy Policy covers the use of cookies by Custom Optical Design and does not cover the use of cookies by any advertisers.

Links To External Sites

Our Service may contain links to external sites that are not operated by us. If you click on a third party link, you will be directed to that third party's site. We strongly advise you to review the Privacy Policy and terms and conditions of every site you visit.

We have no control over and assume no responsibility for the content, privacy policies or practices of any third party sites, products or services.

Aggregated Statistics

Custom Optical Design may collect statistics about the behaviour of visitors to its website. Custom Optical Design may display this information publicly or provide it to others. However, Custom Optical Design does not disclose your personally-identifying information.

Cookies

To enrich and perfect your online experience, Custom Optical Design uses "Cookies", similar technologies and services provided by others to display personalized content, appropriate advertising and store your preferences on your computer.

A cookie is a string of information that a website stores on a visitor's computer, and that the visitor's browser provides to the website each time the visitor returns. Custom Optical Design uses cookies to help Custom Optical Design identify and track visitors, their usage of https://customopticaldesign.com/, and their website access preferences. Custom Optical Design visitors who do not wish to have cookies placed on their computers should set their browsers to refuse cookies before using Custom Optical Design's websites, with the drawback that certain features of Custom Optical Design's websites may not function properly without the aid of cookies.

By continuing to navigate our website without changing your cookie settings, you hereby acknowledge and agree to Custom Optical Design's use of cookies.

Privacy Policy Changes

Although most changes are likely to be minor, Custom Optical Design may change its Privacy Policy from time to time, and in Custom Optical Design's sole discretion. Custom Optical Design encourages visitors to frequently check this page for any changes to its Privacy Policy. Your continued use of this site after any change in this Privacy Policy will constitute your acceptance of such change.

 

 

Credit & Contact Information

This privacy policy was created at termsandconditionstemplate.com. If you have any questions about this Privacy Policy, please contact us via This email address is being protected from spambots. You need JavaScript enabled to view it.