Filter String for Ghost Analysis

  • 13 January 2023
  • 3 replies


Hi community,

I have identified two filter string flags in the manual for analyzing ghosts:

  1. Gn
  2. X_GHOST(n,b)

In both cases “n” refers to the number of the object, which generates a ghost with ray splitting.

However, I am interested in more specific information: For example, which of the three faces of a standard lens object has generated the ghost reflection?

How should the filter string look like if I want to filter a double bounce ray which ghosts at 

face 2 of lens 4 and face 1 of lens 7

just as an example?

The problem seems both to me, simple and relevant. Anyway, I have not found a solution for this so far.

Any hint is appreciated. Kind regards,




Best answer by David 14 January 2023, 00:20

View original

3 replies

Userlevel 6
Badge +2

Hi Joachim,

This is a very good question.  The Filter String is order independent (for the most part) so a filter string of H4 & H7 or H7 & H4 will produce the same results (there are ~ and $ filters which are order dependent but you need to define the full path, not just part of the path).  So in a general sense, you cannot define a if-this-then-that filter string.

For your specific question assuming the lens numbers are in order, it doesn’t quite make sense to have a double-pass system off of lens 4 then lens 7, so I’ll assume you mean lens 7 then lens 4.  For this double pass scenario, if you know the object/face combination you're looking for, you can use a combination of X_HITFACE2 and Gn.  First, for a double pass, you know the ray will have to transmit from lens 4, face 2 and then reflect (probably ghost) off of lens 4, face 2, so it will hit L4F2 two times X_HITFACE2(4, 2, 2).  Next, you know the same ray will have to reflect (definitely ghost) off of lens 7, face 1 and then transmit through lens 7, face 1 after doing the double bounce, so this ray will also hit L7F1 two times X_HITFACE2(7, 1, 2).  Finally, we know the double bounce ghost has to occur do to Fresnel reflections off of L7F1 (otherwise it will be TIR and the intended path, not the ghost path), so we can add a G7 filter (we don't want to add a G4 filter because the second bounce might be a TIR at 100% and not a Fresnel reflection).  So the final filter would look like:

X_HITFACE2(4, 2, 2) & X_HITFACE2(7, 1, 2) & G7 

This would produce the following ray trace:


Userlevel 6
Badge +4

Hi Joachim,

I find that the most useful tool for this is Path Analysis. A description is included in the articles on stray light analysis here. In the attached file, path analysis identifies the primary ghost path and assigns it a filter string “_4” which can be used to visualize it.

However, path analysis does not distinguish between faces of objects. If you need to do so, or if your OpticStudio version does not support path analysis, it is possible to craft very detailed filter strings using boolean combinations of filters. For example, in the attached file a boolean construct X_HITFACE2(2,2,2)&X_HITFACE2(3,1,2) selects rays that have hit object 2 face 2 twice and object 3 face 1 twice.

In the layouts, path analysis path _4 is on the right; the above filter string is on the left.


I attach the example file as a ZAR in a ZIP. It includes those and other filter string examples.



So the final filter would look like:

X_HITFACE2(4, 2, 2) & X_HITFACE2(7, 1, 2) & G7 

This would produce the following ray trace:


Thank you Michael and David for your sound answers!
May I follow up with a consecutive question?

In my optical system I consider 21 surfaces for ghost generation. This results in 21*20/2 = 210 double bounces. 

For this quite a lot to handle, I have the following idea for simplification:

Instead of considering all pairs of surfaces separately, it is sufficient to consider the full contribution of each of the 21 surfaces. The filter for the contribution of surface 1 of object 7 reduces from 
X_HITFACE2(4, 2, 2) & X_HITFACE2(7, 1, 2) & G7 to

X_HITFACE2(7, 1, 2) & G7

The sum of the ghost energy of the 21 individual contributors is of course not equal to the total ghost energy then. However, the worst offenders should be identifiable this way.

Kind regards,