Simulating the spatial luminance distribution of planar light sources by sampling of ray files

: Ray files offer a very accurate description of the optical characteristics of a light source. This is essential whenever optical components are positioned in close proximity (near-field) of the light source in order to perform accurate ray tracing simulations. However, a ray file does not allow for a direct simulation of the spatial luminance distribution, i.e. luminance map, by off-the-shelf ray tracers. Simulating luminance maps of light sources or luminaires is especially important in general lighting in order to predict their general perception when viewed by the observer, and more specific, the perception of glare of luminaires having a non-uniform luminance distribution. To enable the simulation of luminance maps while maintaining the high accuracy offered by a ray file, a sampling method is presented. To validate the approach, near-field goniophotometer measurements of two planar light sources were performed. From these measurement data, ray files were extracted to which the sampling method was applied in order to obtain a set of surface sources. This approach was validated by comparing measured luminance images with simulated luminance images. A good agreement was found, validating the presented method.


Introduction
The main characteristics traditionally investigated when developing a luminaire by means of ray tracing software are the luminous intensity distribution (LID), the illuminance distribution on a task surface and the luminaire efficiency. However, more and more optical engineers acknowledge the need to investigate the spatial luminance distribution (luminance map) of the luminaire during the development stage [1]. Luminance maps are not only a tool to assess subjective criteria such as the aesthetics of the lit luminaire, but also provide objective information to assess quality criteria such as contrast and the degree of discomfort glare [2,3]. Indeed, discomfort glare, expressed by the Unified Glare Rating (UGR) [4], is normally calculated from the average luminance value of the luminaire which in turn is found by dividing far-field intensity values by the surface area of the light source. However, for luminaires with a non-uniform luminance distribution, this approach becomes invalid, and glare evaluation should be performed based on luminance maps which are converted to brightness images. Glare sources can then be identified from these brightness images [5]. Luminance maps can be simulated by tracing rays through the optical system starting from an observer's point of view. These rays are propagated throughout the optical system until they intersect with a light source. This approach requires the light source to be defined as a surface source having a predefined LID -which in turn means a uniform exitance across the surface source. By sampling the LID of the light source, luminance values are attributed to each ray hitting the surface source from a particular direction. Optical interactions (refraction, reflection, absorption, etc.) of each ray are stored, and are taken into account to calculate the luminance value of each pixel in the luminance map, represented by a pixelated viewing plane.
For many optical systems however, light sources need to be characterized very accurately, both angularly and spatially, especially when they are located in the proximity of other optical components [6]. Such an accurate light source representation can be achieved with ray files obtained from near-field goniophotometer measurements [7][8][9][10]. While no standardized file format for ray files is available at the moment [11], ray files traditionally contain a predefined number of rays, each ray typically represented by a starting position, a direction vector, and a luminous flux. Recent research investigated and suggested the incorporation of luminance in ray files [12], however at the moment such ray files cannot be generated directly from nearfield goniophotometer measurements. Although the traditional ray files offer an excellent way of describing light sources when LIDs or illuminance distributions have to be simulated, they cannot be used directly to simulate a luminance map, as this requires the sampling of the LID of the light source -which is not directly available when a ray file is used.
To overcome this issue a brute force method has been presented [13], which is however time consuming as a large amount of rays need to be traced before an acceptable quality of the simulated luminance distribution is achieved.
Another interesting approach is to generate a multitude of point sources each with a specified LID by sampling the ray file [14]. Triangular meshes can be defined, with each vertex of the mesh having a particular LID. An important limitation of this method is that off-the-shelf available ray tracers are not capable of sampling the triangular meshes as an interpolation between the LIDs of the vertices is not supported [14]. Furthermore, while this method yields good results when simulating illuminance distributions it is not investigated whether the same applies for luminance maps.
In this paper, another method of sampling ray files to overcome the drawbacks and limitations of the method described above is presented. The method can be used in conjunction with any optical ray tracing software without the need to adapt the ray tracer algorithms as long as the ray tracer supports surface sources which are defined through an LID.
To validate the proposed approach, it is applied to a planar light source with a lambertian LID and to a planar light source with a more complex asymmetric LID. At first, the near-field light distribution of both sources is measured with a near-field goniophotometer. From these data, ray files are extracted, which in turn are sampled according to the method as described in this paper, resulting in a set of LIDs. These LIDs are imported in TracePro® [15], a commercial ray tracer and assigned to surfaces, creating a set of surface sources. Luminance maps of both light sources as seen from different viewing angles are simulated and compared with the experimental luminance distributions. In both cases, an excellent agreement is found between the simulated and the measured luminance distributions.

Methodology
The near-field measurements are performed with a commercially available near-field goniophotometer from TechnoTeam [7] (RiGo801 for small light sources with a diameter < 30mm). A maximum of 10 9 rays can be generated from near-field data measured with this device. The center and the light emitting surface of the light source under investigation are aligned respectively with the origin of the coordinate system XYZ and the XY plane of the near-field goniophotometer.
The following algorithm is performed to generate a set of surface sources by sampling the ray file of a planar light source.
1. Generate a ray file from the measured near-field with the maximum number of rays (10 9 ). Determine the starting position (x r ,y r ,z r ) of each ray by finding the intersection of each ray direction d(a,b,c) and a user defined bounding surface from which all rays should start. The user defined bounding surface is assumed to be a planar surface located in the XY plane. The direction d and luminous flux Φ r of each ray are determined by the near-field goniophotometer measurement.
2. Divide the bounding surface into equal area square pixels P(i,j) with a resolution Δd.
3. Select each ray and determine the pixel P(i,j) where this ray originated from by evaluating the start position of the ray (i.e. (x r ,y r ,z r )). Add the luminous flux of the ray to the pixel flux Φ P(i,j) .
4. Calculate a luminous intensity distribution (LID) for each pixel P(i,j) as follows: a. For each ray emitted from P(i,j), calculate the spherical angles (θ r ,φ r ), with θ r the polar angle between d(a,b,c) and the surface normal (Z-axis) and φ r the azimuthal angle between d(a,b,0) and the X-axis.
d. Evaluate the angles θ r and φ r for each ray emitted from pixel P(i,j) and add the flux of the ray, Φ r , to the flux of the respective bin B θ,φ resulting in the total flux Φ Bθ,φ .
h. If the percentage error is larger than a predefined threshold go back to step 4.b while decreasing the values for Δθ and Δφ with 1°. Care should be taken that the adjusted Δθ and Δφ values result in an integer number of bins. Repeat this until either the predefined threshold or a predefined minimum value for Δθ and Δφ is reached. In this paper we use 1° as the minimum value for both Δθ and Δφ. The angular binning during the first iteration and second iteration is displayed in Fig. 1(a) and Fig. 1(b), respectively.
5. Write the calculated intensity distribution for each pixel to a file which can be imported and interpreted by the ray tracer. A flowchart of the presented algorithm is shown in Fig. 2.

Experimental validation
To validate the presented method, two practical examples are discussed. In both cases, a remote phosphor LED module (RPLED) [16,17], i.e., a light source with lambertian emission, is employed. This source emits light from a circular planar area with diameter 23 mm.
First, the near-field light distribution of the RPLED is measured with a near-field goniophotometer (RiGo801), by moving the camera and the photometer to various points on an imaginary hemisphere with an angular resolution of 0.5° for both the polar and azimuthal direction. This measurement results in a .ttr file, which is a proprietary file format from the manufacturer. A ray file containing the maximum amount of rays that can be generated (10 9 ) is created from this .ttr file. Less rays could be used as input for the sampling algorithm, however this would also mean that less information is available and as such the subsequently generated luminance distributions would also become less accurate.
Next, this ray file is processed and sampled with Matlab according to the presented algorithm. The spatial resolution of the square pixels in which the ray file is divided, is set to 1 mm. As a result, 437 luminous intensity distributions are created. Less LIDs are created than expected (23 2 = 529), as pixels where no rays originate from are not taken into account. The total required disk space for these 437 LIDs is around 30MB, i.e., only 1/830 of the disk space required for the original ray file. These LIDs are imported in TracePro® [15] and applied to square surfaces with a width and height of 1 mm.
With the model of the light source completely defined as a set of surface sources, several luminance maps, each calculated from a different observer position, are simulated by tracing rays starting from the viewpoint of the observer towards the set of surface sources. Each luminance map has a width and height equal to 23 mm and is divided into pixels with a width and height of 1 mm. For each pixel in the luminance map, 10 3 rays are traced. The observer position is expressed in spherical coordinates (θ o ,φ o ), while the distance between the observer and center surfaces remains 1000 mm. In total, 4 luminance maps for an observer position of To allow for a visual comparison between the measured and simulated luminance maps, the spatial resolution of the experimental luminance map is set to be the same as the resolution of the simulated luminance map. The results are shown in Fig. 3, including a figure presenting a percentage difference image, Diff, calculated as: with L m and L s the luminance of each pixel in the measured and simulated luminance distribution respectively. As can be seen, a very good agreement is found. The larger differences at the edges of the light source originate from pixel discretization and small mismatches between the alignment of the light source during the measurement of the luminance maps and the measurement of the ray file. Another reason for these differences is found in the original ray file where fewer rays start from the outer edge of the source compared to the center area. As a result the ray file will be less accurate for pixels located at the outer edge.
Apart from a visual assessment of the quality of the simulated luminance maps, the differences between simulated and measured luminance distributions are quantified by calculating both the normalized cross correlation ratio (NCC) [18], a method for template matching, and the normalized root-mean-squared error (NRMSE) between the measured and simulated luminance maps. The NCC and NRMSE are defined by Eqs. (5) and (6), respectively: with m L and s L the mean values of the respective luminance map and X and Y the pixel coordinates. The NCC value can range from 0 to 100%, with 0% meaning no correlation at all, while 100% implying a perfect match between the relative shape of the luminance maps. Note that this value only gives a measure of similarity [19]. Therefore, it is necessary to calculate both the NCC value and the NRMSE value, as the latter takes into account the absolute differences of the luminance maps. The calculated NCC and NRMSE values for each observer position are presented in Table 1. As expected from the visual comparison of the luminance maps, an excellent agreement is found as the NCC values are larger than 99% while the NRMSE values are low. To put the differences at the outer edge in perspective, a horizontal cross section of the simulated and measured luminance map for an observer position of (θ o ,φ o ) = (0°,0°) at Y = 11 mm is shown in Fig. 4. Here the differences at the edges appear to be very low in comparison to the maximum luminance values obtained in the center near X = 12 mm. In the validation experiment described above, the light source being modeled was lambertian, and as a result most of the surface sources exhibit a rotational symmetry. To verify that the presented method also works for individual asymmetric surface sources, a brightness enhancement film (BEF) [20] with a thickness of 1 mm was added on top of the remote phosphor plate of the RPLED module. This results in a Full Width at Half Maximum (FWHM) of 120° for the C0-C180 plane, while the FWHM is decreased to 90° for the C90-C270 plane. This film consists of a linear prismatic structure which reflects and refracts incident light to enhance the light output within a specific viewing cone; a technique often used in LCD backlights. Again, the near-field of the RPLED module, now in combination with the brightness enhancement film, was measured with the near-field goniophotometer. A ray file was generated from the measured data and processed/sampled according to the presented method using the same settings (pixel resolution = 1 mm). Luminance maps are simulated for the same observer positions as in the first case, but in addition luminance maps are also simulated for the observer positions Luminance maps for all these observer positions are also determined with the near-field goniophotometer, and compared with the simulated luminance maps through percentage difference images. The results are shown in Fig. 5 and Fig. 6 for the observer positioned at a 0° and 90° azimuthal direction, respectively. A good agreement between measured and simulated luminance maps is again found for almost all observer positions. However, from these figures, the effect of the brightness enhancement film is not clearly visible. The cross section of the luminance map for the observer position (θ o ,φ o ) = (60°,0°) and for an observer position (θ o ,φ o ) = (60°,90°), as shown in Fig. 7, clearly illustrates the impact of the film.
NCC and NRMSE values are calculated for each observer position and presented in Table  2. The agreement for observers at large polar angles (near grazing) is clearly not as good compared to the results obtained without applying the BEF ( Table 1). The reason for this mismatch between simulated and measured luminance images for near grazing angles is due to the fact that the side surfaces of the 1 mm thick brightness enhancement film also emits light -an effect which is not included in the simulations as the light source is modeled as a planar source.
Due to the structured surface created by the BEF, it can be interesting to investigate the effect of the use of smaller surface sources. Surface sources with a resolution of Δd = 0.5 mm are generated from the ray file. Similarly, luminance maps are simulated for the various observer positions and compared with the measured luminance maps, resulting in a second set of NCC and NRMSE values as displayed in Table 2.  In analogy with the visual comparison, the NCC and NRMSE values indicate again a good agreement between the simulated and measured luminance maps, but the NCC and NRMSE values for the observer positions (θ o ,φ o ) = (80°,0°) and (θ o ,φ o ) = (80°,90°) are again worse than for the other observer positions, but are still acceptable. Surprisingly, the NCC and NRMSE values for these grazing angles become lower respectively higher when changing the resolution of the individual surface sources from 1 mm to 0.5 mm. Indeed, as the size of the surface sources becomes smaller, the luminance values are averaged out over a smaller area. This results in a higher detail and consequently the mismatches caused by the sides of the brightness enhancement film become more and more present.
Finally, the sampling requirements of the presented algorithm are investigated. While the pixel size determines the spatial sampling, the predefined threshold, as described in the algorithm in step 4.h, controls the angular sampling. The influence of the latter on the overall model quality of the light source is investigated. To this end, several models of both the RPLED and RPLED with BEF are created with different predefined thresholds. The analysis of the overall quality of the model of the light source is performed on the complete LID emitted by the model. As such, each surface source is attributed a number of rays in order to generate a total of 10 6 forward rays, while the number of rays attributed to each surface source is weighted with the emitted luminous flux of the surface source in question to the total emitted luminous flux of the whole model. Next, a ray file, also containing 10 6 rays, is generated from the original proprietary .ttr file. LIDs of each model and the ray file are simulated and compared by evaluating the NCC and NRMSE values which can be calculated by replacing the spatial coordinates and corresponding luminance values of Eq. (5) and Eq. (6) with spherical coordinates and corresponding intensity values [21,22] respectively. The results of this analysis for the RPLED and RPLED with a BEF are displayed in Fig. 8 and Fig. 9 respectively. Fig. 8. NCC and NRMSE evaluation of the generated LIDs of the RPLED for various predefined thresholds E. The optimal point, i.e. the maximum and minimum for NCC and NRMSE, respectively, is located at a 2.1% setting for the predefined threshold. Fig. 9. NCC and NRMSE evaluation of the generated LIDs of the RPLED with a BEF for various predefined thresholds E. The optimal point, i.e. the maximum and minimum for NCC and NRMSE, respectively, is located at a 0.021% setting for the predefined threshold.
In both Fig. 8 and Fig. 9 a large predefined threshold causes little or no change in the overall quality of the model. As the threshold becomes lower, more bins will be needed to accurately describe each LID of a pixel, and as such specific characteristics of the LID can be captured and the overall quality of the model improves (i.e. lower NRMSE and higher NCC values). However, as the predefined threshold becomes even smaller the overall quality decreases as overfitting of the LIDs occurs. This overfitting results from the lack of rays in a single bin. The optimal predefined threshold is located where the NCC and NRMSE reach a maximum and minimum, respectively. For the RPLED and RPLED with a BEF, this point is located at a value for the predefined threshold of 2.1% and 0.021%, respectively. As the RPLED with a BEF is less symmetric compared to the RPLED, a lower predefined threshold and as a consequence more angular bins are needed to accurately characterize the light source. A similar method can also be used to investigate the spatial sampling requirements in order to find the optimal spatial binning (i.e. pixel resolution).

Conclusion
In this paper, a method to sample ray files of planar light sources into a set of LIDs, which can easily be imported in any ray tracing software and applied to surfaces in order to create a set of surface sources, is presented. This enables the simulation of luminance maps which are of high importance when predicting the discomfort glare or contrast of virtual prototypes of optical systems, while maintaining the high accuracy offered by a ray file to describe the near-field light distribution. This method can be applied to generate luminance maps of light sources and of virtual prototypes of luminaires as well, on condition that a ray file is available.
Two practical examples were discussed in order to validate the presented algorithm. Experimental luminance images were compared to simulated luminance images of a planar light source, and of the same light source incorporating a brightness enhancement film. In both examples a good agreement was obtained, validating the presented sampling method for both symmetric and asymmetric distributions. The sampling method also has the benefit of drastically reducing disk space requirements to characterize the near-field of a light source. In addition, the light source model created with the presented method is able to generate as many rays as necessary compared to ray files which always have a fixed amount of rays upon creation.
The presented method can be useful to describe the near-field of the rapidly developing Organic Light Emitting Diodes (OLEDs) which are typically planar. Additionally, the presented method can be extended to light sources for which the bounding surface is not planar. An obvious complication is the switch between the variable local pixel coordinate system towards the general coordinate system. Future work includes extending and analyzing the presented method to accommodate for non-planar light sources.