Skip to main content

Hello,



I'm using Zemax OpticStudio 18.4.1 Premium in the non-sequential mode. My optical system consists of a light source (source radial) with 2 wavelengths and 1e5 beams, 2 detectors (rectangular) and a bulk scatterer (volume physics -> angle scattering) with wavelength shift. So far it is working as I would expect it. But when it comes to ray analysis there are some, at least to me, miraculous things happening.



I saved a ray file (polarization, scattering and ray splitting on) and tried to use filter strings in the path analysis window. At first sight it seemed to work but only on the first sight. For example, I tried to get only the beams with wavelength shift. So I used 'X_WAVESHIFT(1,2)' and I got a result. In addition I tried 'X_WAVESHIFT(1,2) & H9' (Object 9 is the one with the bulk scattering properties; the only one in the system) and I got a different result (smaller power). How is that possible? The same thing happens if I use the strings directly in the detector window



Now I used the generated path analysis flags in order to have a look on what is happening there. And so I figured out that some of the rays didn't experience a wavelength shift. How is that possible? Shouldn't the filters show only the 'inelastic' scattered ones?



I am really a bit confused here and would be grateful for any help.



Thanks a lot in advance and with best regards,



Martin Jahn



p.s. I hope I didn't miss to include some standard information or that usually a minimal example is required. If so, I want to apologize in advance.

Update: I think that my problem could be related to the definition of 'hit' an object. The only definition of 'hit' I could find is a text fragment in the help article to the Ray Database Viewer. There it is stated: 'Hit indicates the object number struck at the end of the segment.'. But to me it is not exactly clear how it is possible to have both, rays that hit object 9 and rays that did not, while being bulk scattered in object 9? So, what is the exact definition of 'hit' an object?



A workaround in my case is to use 'B9', the filter string flag for bulk scattering, instead of 'H9'.


I don't think that's a workaround as much as intended use. Bn is true for rays that bulk scatter from object n, Hn is true for rays that hit (has any kind of interaction with) object n. If you look in the Help file for 'filter string' you'll see the docs for all filters:





 



Where did you see that fragment that refers to the end of the segment? Ln is the variant of Hn that is true for rays that hit object n as the last segment, but Hn is true for any ray that has any kind of interaction with object n at any segment.


Dear Mr. Nicholson,



Thanks for your reply and your support. You are completely right, workaround is the wrong term in this case. Bn worked only better or, lets say, more in the way I would have expected that it would work compared to Hn.



I knew the 'filter string' help entry already and that is why I tried Hn in the first place. My aim is to find / track all rays that got bulk scattered in object 9 with a wavelength shift. Object 9 is the only object in my model which has this property. So, I thought:



(a) 'X_WAVESFHIFT(i,j)' should show me all rays that experienced a wavelength shift during a bulk scattering event



(b) 'Hn' should show me all rays that interact with object n



Hence, the logical combination 'X_WAVESHIFT(1,2) & H9' should show me all rays that interacted with object 9 and got bulk scattered (there) with wavelength shift.



For test purposes I tried only 'X_WAVESHIFT(1,2)'. But 'X_WAVESHIFT(1,2)' and 'X_WAVESHIFT(1,2) & H9' gave different results (the ladder flag ended in half as much power on the detector) which I could not understand. That's why I tried also 'X_WAVESHIFT(1,2) & !H9' in order to figure out where the 'missing' rays are. And the sum of 'X_WAVESHIFT(1,2) & !H9' and 'X_WAVESHIFT(1,2) & H9' gives indead exactly the result from 'X_WAVESHIFT(1,2)'.



Now I am wondering: How it is possible that a ray gets bulk scattered in object 9 without hitting (or interacting) with it?



Yesterday, I checked the Ray Database Viewer on a different example, where objects 3 and 4 are the 'inelastic' scatterers. Here I used '!(H3 | H4) & X_WAVESHIFT(1,2)'. An example ray looks like this:





It somehow never hits object 3 but it is inside ('In' = 3 for 'Seg#' = 3 but 'Hit' = 0) it. Therefore I went to the help of the Ray Database Viewer and there I found in the subchapter 'diskussion' the following line: '“Hit” indicates the object number struck at the end of the segment. The source segment has a hit number of 0, since the XYZ coordinates listed are the starting and not the terminating coordinates of the segment. For all other segments, the XYZ coordinates and other data are at the segment end on the “hit” object. If the hit object is 0, the ray missed all objects and is terminated.'



My only guess at the moment is the following: I created the void, where I put the scatterer in, via Boolean CAD. Maybe something went wrong there. But then I would at least expect that all scattered rays would behave the same way and not half interact with the object and the other half does not (while being scattered the same way).



That is what I find at the moment quite confusing. With Bn I found a way that is working better for me but I would still like to understand the matter, especially for future problems.



 


Hi again Martin,



To test this out, I used the sample file Documents\Zemax\Samples\Non-sequential\Phosphors and Fluorescence\Fluorescence Example using Waveshift.ZMX. The properties of the Bulk Scattering Object 2 are



 





and the filter works just as I expect:





Do you see this too? Or, can you reproduce the problem you are having when using this file? It's much easier to debug when you can see the problem.



 



 



 


Hi Mark,



Thanks for your reply. Yes, I get the same result as you do. In order to reproduce the problem I made kind of a minimal example. It consits of a source, a detector and a glass body with two separated bulk scatterers as insets. The insets are realized via boolean CAD (I know, boolean native would be the method of choice but in case of the real example I had to use boolean CAD). In other words, there are two objects with bulk scattering properties and a glass bulk. Via boolean CAD I substract the scatterers from the bulk and get the glass bulk with voids. Since the scatterers are not neclected in the ray tracing they act as insets.



The problem is still the same: There are rays which don't hit the scatterers but they are still scattered with wavelength shift. Hence, 'X_WAVESHIFT(1,2) & (H2 | H3)' (rays that hit the scatterers and got scattered) results in lower power on the detector compared to 'X_WAVESHIFT(1,2)' (rays that didn't hit the scatterer but still got scattered).



In addition, I played a bit around with this model:



(a) Realization of the insets via nesting rules


(b) Adding two dummy objects (same geometry and position as the scatterers but without scattering properties) for the creation of the voids (via boolean CAD)



In both cases the problem does not appear. Hence, using boolean CAD on objects with bulk properties seems to cause these kind of problems. I know that boolean CAD isn't only taking the geometry of objects into account but also coatings on their surfaces. But I didn't expect this behavior.


I agree, something's not right here.





The filter string X_WAVESHIFT(1,2) & !(H2 | H3) should yield zero rays as it selects those rays that waveshift but do NOT hit 2 OR 3. This shows about 3000 rays meeting that condition. Interestingly, the ray database viewer (correctly) shows zero rays meeting this condition:





but the layout shows the 3000 rays:





Something's not right here, one for support I think.



BTW, you can use the native Boolean for this file just fine, as you are not using any CAD objects here, but you don't need to use the Boolean at all. The overlapping objects rule works just fine, and not using the Boolean fixes the bug, whatever it is:





I've attached my modified file.



 



- M


Hi Mark,



Thanks for your help. I am still a bit puzzled what exactly happens there but I learned to be careful with boolean CAD in combination with object properties. Moreover, next time I'll provide directly an example. First, it helps the reader a lot and, second, during the process of reproducing the problem I had some additional insight.



So, thanks again and have a nice day.



Greetings,


Martin


Hi Martin and Mark,



Michael H and I have looked into your example and we don't think there is a bug with the Boolean CAD.



When a ray enters the Object 3 bulk scatter, the actual HitObject and HitFace flag are for Object 4’s face.





  • When the ray scatters directly out of Object 3 into air, the HitObject and HitFace are for Objecy 3 ’s face. That is the expected case below.








  • When the ray scatters back into Object 4, via the nesting rule, the HitObject and HitFace are for Object 4’s face again. This unexpected result is still 100% correct based off the nesting rules so therefore, there is no bug.




Let's have a look at the 2nd case in the Ray Database Viewer:





 





So this is all correct.



 



Now let's have a look at the case with the Boolean Native. I ran a raytrace and then filter rays with X_WAVESHIFT(1,2). There is no rays that meet this condition. In fact rays that go within objects 2 or 3 do not seem to bulk scatter. So it seems to me that there is a bug here. But I'll confirm with Michael.



I understand that this is just an example to illustrate an issue. However if you have to model something like this, I would use only the nesting rule. It makes it easier for the software.



Let me know your thoughts and comments.



Sandrine



 



 



 


I have reported a bug about the Boolean Native.


Reply