# Generation of Rays for Ray Tracing

*Author: Frank Wyrowski (July 14, 2021)*

In ray tracing for lens systems the rays are originated in the object points and the specific selection is often done with respect to the stop, e.g., the chief ray goes through the center of the stop. If we look from a physical-optics perspective on this ray selection, we identify the rays to be orthogonal onto the wavefront of spherical waves which have their origins in the object points. In VirtualLab Fusion this scenario can be obtained by selecting shifted spherical field source modes in a source plane.

Next let us consider a Gaussian source mode, which is defined in its waist. Which rays should be now used for ray tracing? The wavefront phase in the waist of the Gaussian is planar. Thus, rays which are orthogonal to the wavefront point all along the z axis. In other words, the rays do not express the divergence of the beam. If such rays are propagated through a lens system, a correct focal position can not be expected. In other words, the divergence of a Gaussian beam in its waist is fully expressed by diffraction and not by the wavefront phase. Thus, it makes no sense to define rays in the source plane.

How can both example scenarios, the one for the spherical and the one for a Gaussian mode, be treated in a reasonable and unified way in ray tracing? How to generate the rays?

Our answer is based on physical optics and the way how ray optics is embedded in it. The user can select the option *Include Diffraction-Induced Contribution to Ray Direction. *Then, in case of the Gaussian beam or any other source mode, the divergence of the mode at the first surface which should be traced through, is calculated including diffraction effects. That provides the information we need to generate rays with directions which include the divergence.

In summary, we perform a physical optics propagation from the source plane to the first surface of the system and generate the rays there. By proper selection of the Fourier transforms diffraction is included or not. That demonstrates, that even for basic ray tracing an initial physical optics modeling step is often needed. VirtualLab Fusion is doing that on demand by selecting *Include Diffraction-Induced Contribution to Ray Direction. *

The initial physical-optics step provides us with another option. In the plane in which the rays are generated, we also know the field amplitude and by that the associated energy per ray. The option *Unselect Rays with an Associated Energy Smaller Than x%* discards rays, whose energy is smaller than x% of the maximum ray energy in the plane.

- White Paper - Generation of Rays for Ray Tracing pdf 05.08.21