How to check relative illumination at 'object' surface (verify the relative illumination theory)


Userlevel 4
Badge +1

Sometimes, we may design the system starting from the 'image' back to the 'object'. For example, this is often the case for those systems that are designed to be viewed by eye, like AR/VR, HUD. In this case, normally, if we want to check the relative illumination, we need to reverse the system to check because the tool 'Relative Illumination' only calculates that on last surface in the system.


Here we will provide another way to calculate it using a macro so that you don't need to reverse the system.


Note here we at the same time is also demoing how you can verify the calculation theory of the RI. RI is actually much easier to calculate if the system is reversely designed!


 


First, by reading the follwoing forum post, we know that relative illumination at each field is exactly linearly dependent to the area of the beam in cosine space in image space.


FAQ about Relative Illumination


 


So, here is the plan. We want to write a macro to calculate the beam area in cosine space for each field, normalize it, and then get the the RI.


For simplicity, we assume the system only has apertures but no obscuration. Also we assume the chief is able to pass the system without vignetted by apertures. Note but we do will consider the effect of vignetting by aperture. In other words, if this a traditional rotationally-symmetric lens, this macro should work well.


Let's first demo how it works and then explain the code.


1. Open the \Documents\Zemax\Samples\Sequential\Objectives\Cooke 40 degree field.zmx



2. Turn on Ray-Aiming



3. Open the RI with default setting and check the result as below.



4. Remove all solves on Radius and Thickness.



5. Reverse the system from surface 1 to surface 6.



6. Copy the thickness from last one to first.




7. Now run the attached macro and we can see the result is same as the RI we calculated before reversing the system!




 


Now, let's check the code.


1. At first, we mainly set two variables for sampling rate and two array for saving the data to plot later.



2. In the loop, it will be easier to start from looking at the 3 set of coordinates that is in cosine space. (a0,b0), (vec1a,vec1b), and (vec2a,vec2b).


Note there is one special part in line 46-54. At this part, we are check if there is any vignetting in the system. The loop first check the marginal ray which has px^2+py^2 = 1. If this ray is blocked by aperture, RAYV() will return non-zero. Then we trace another moer 'inner' ray by a scale. This loop test the scale from 1 until -1 and stop when it finds the ray can pass. By doing this, we can know the correct cosine space area considering the system apertures.



These three points are in the cosine space. The (a0,b0) is of the chief ray. The other two points are of the marginal rays. The idea is that we can use the highly sampled polygon to estimate this beam's area in the cosine space. We just need to loop for all the triangles as shown below and sum up their area.



3. It can be seen how we calculate the area of the triangle and accumulate the total area at line 79.



4. Finally, at line 97-109, we simply normalize the series of the cosine space area by its maximum. Then we plot it in line 111-115.



8 replies

Userlevel 4
Badge +1

Attahced in this reply is another modified version written by Zemax staff Julia. This is supposed to be used in merit function so that users can optimize the system considering the relative illumination for reversed system.


This macro should be saved in {Zemax Data folder}\Macros\. Then it can be used in merit function as below. The macro only read the parameter 'Hy'. It calculates the area at cosine space, for Hy=0 (say PSA0) and user-specified Hy (say PSAy) and then return the ratio of PSAy/PSA0. In other words, the RI value is normalized to the central field (Hy = 0).


Hello Michael

Thanks for your great answer!

I want to know why I need to reverse the system for RI calculation? If I don’t invert the system, can I use this code to solve RI and just change the solution surface of each function to the image surface?

 

Best,Nancy

Userlevel 4
Badge +1

Hi Daniel,

Thank you for reply!

The only reason I reversed the system here is to verify this method by comparing it to the built-in tool. You should not use this code if you simply want to calculate the Relative Illumination on the image surface.

You can find the built-in RI tool as shown below.

 

This code calculates RI in object surface. This is useful when you system is designed reversely. For example, most of AR/VR/HUD systems are designed in this way.

 

I hope this clarifies it for you. Please feel free to let me know if you have more questions.

Thank you.

 

Michael

Hello Michael

Thank you for your reply! Your answer helped me a lot.
I tried this code in an optical system, modified the surface parameters, and found that the RI can also be calculated relatively accurately on the image surface. But I have another question: Why should we turn on the light aiming? What is the impact of it  when caculate illuminance?

 

Best, Nancy

Userlevel 4
Badge +1

Hi Daniel,

In short, Ray-Aiming makes sure we exactly consider the beam that fulfills the STOP well. If you don’t turn it up, the beam from each field may be distorted and does not well fulfill the STOP.

For more details about ray-aiming, I suggest to read this knowledge base article: https://support.zemax.com/hc/en-us/articles/1500005486881-How-to-use-Ray-Aiming

Best regards,

Michael

Hi Michael

Thanks for your reply!I now understand the function of  Ray-Aiming.

But :joy: the website you gave can not be opened, it prompt: The page you are looking for does not exist, you may have entered the wrong URL, or the page has been moved.

I don't know why this happens, I wonder if you can provide the URL again if it is convenient,Thanks you so much !

 

Best, Nancy

Userlevel 4
Badge +1

Hello Daniel,

I’m happy I can help! I have checked and I think the link should work. On possible reason you cannot see the website is your browser language is not English. The solution is you manually select English highlighted above.

 

Please do not hesitate to let me know if you still cannot see the content.

Thank you.

Hello Michael


You are right, I can open this page already. Excuse me for giving you so much trouble, thanks!

 

Best,Nancy

Reply