About RayLab

RayLab is an application for design and simulation of optics on the iPad. It can be used as either as a learning tool, or to design real optical systems.

Key features include:

  • Support for Lenses, Mirrors, Lens Arrays, Diffraction Gratings, Prisms.
  • Full control over placement and shape of optical components.
  • Full control over aspheric surface shape parameters.
  • Full geometric ray tracing.
  • Sequential and Non Sequential analysis.
  • Front Focal Length, Back Focal Length, Principle Surface calculations.
  • Ray Transfer Matrix calculation.
  • Multiple Analysis Modes:
    • Fan Ray Diagram.
    • Wavefront Error Plot.
    • Grid Distortion Plot.
  • Tutorial examples.

If you have suggestions for new features or usability improvements please leave me a comment below.

91 thoughts on “About RayLab

  1. Derek

    The simulator doesn’t represent what light does at a very low angle of incidence.
    In real life, if light hits a surface, such as a still pond, at a low angle, the surface acts llike a mirror. In the app, it doesn’t, regardless of the angle.
    The sim does, however correctly reproduce internal reflection.
    Could you work this little kink out?
    Thank you.

    1. Kamyar Post author

      Hi Derek,
      The phenomenon you are describing is partial reflection (Fresnel reflection: http://en.wikipedia.org/wiki/Fresnel_equations). At any angle some of light is reflected and some of the light is refracted. At low angles of incidence most of the light is refracted, while at very high angles of incidence most is reflected. To model this phenomenon the App would need to support ray splitting, as well as track the intensity of each ray, neither of which it is currently able to do. So it is not trivial to add this capability to the app. I will keep this request in mind for the future, but I am afraid it will be some time before you see this capability.

      P.S. Even Zemax does not include Ray Splitting in the Standard Edition ($2500.00). They only include it in their Professional Edition ($6500.00).

  2. Willi


    RayLab is very nice program. Very useful and easy to use! Thank you.

    Is it possible to immerse a lens in a liquid? I noticed, that I can only choose a material for the first surface of the lens. For the second one, the glass menu is blocked. Please, advice on how to do this.

    Best regards

    1. Kamyar Post author

      Hi Willi,

      Currently RayLab does not support this. The reason is that RayLab is not a sequential program. It is non-sequential. Meaning that a ray can travel thru surfaces in any order, or even bounce back and forth between surfaces. To allow this while also permit lenses to be dragged around freely and reordered I needed to restrict them all to be in air. I will think about how to support this capability in a future release.

  3. Willi

    Hi Kamyar,

    Thank you for the quick reply!

    I understand. I am using FRED a lot and I was looking for a simple ray tracing program for the iPad. Yours is by far the best I found.

    I was thinking to use a lens made of the liquid in between the actual lenses and have the surfaces basically touch. So the air gap would be zero or almost zero.

    I then also realized, that I could not use arbitrary refractive indices for polymers or oil. Is there a way to define my own material database?

    1. Kamyar Post author

      Ability to define custom refractive indices is a popular request. I will probably be adding this ability in the very near future.

      A very small air gap should probably work for you. But a zero gap may cause confusion of the algorithm. The achromatic doublet actually does use a single surface in the middle with different material on each side. So a simple enhancement would be for me to add a fused lens triplet to the options. Then you could select oil for the middle element.

  4. Willi

    Thank you! Sounds like a plan 🙂

    I will give it a try with the doublet.

  5. Yves

    Hi Kamyar,

    I am experimenting with Freznel zone plate optics, however in your application I did not see them as an option in the advance lenses. I tried to make one with superimposed mirrors so that I will have the appropriate appertures between them but I am not conviced that it is working the way a true zone plate would. Any suggestions? A flat non reflecting surface in which we could draw a patern would be usefull in this case. Thank you for otherwise a great application.

    1. Kamyar Post author

      Hi Yves,

      Thank you for the suggestion. I did a bit of reading on Fresnel Zone Plates, and am not sure how well I could model them in RayLab. RayLab is essentially a ray tracing application. Most of the elements it models involve reflection or refraction. It does model diffraction gratings with some limitations. For diffraction gratings it assumes that the grating pitch is high such that their spacing is on a similar scale as the wavelength, and that the beam is wide enough to cover many gratings. This allows use of the grating equation. Even with these assumptions it only models the behavior for a single diffraction order (m). It allows you to choose which m to model.

      I suspect that if I were to model Fresnel Zone Plates, similar limitations would apply. That is only zone plates with fairly high pitch would be modeled well. And only one diffraction order would be modeled at a time. It would certainly not do a good job modeling coarse zone plates. Would that be of any use to you? I will think more about this suggestion, but it does not seem promising.

    2. Kamyar Post author

      Hi Yves,

      I have done some further research on Zone Plates. I believe to get the types of results you are interested in you need an application which can perform Physical Optics Propagation. This means that beams are propagated using the wave equation. While I do have experience with this type of analysis, it is not within the scope of RayLab’s capabilities. RayLab is essentially a Geometric Optics application, which means it performs ray tracing.

  6. Archaeopteryx

    Caveat: I have no idea what I’m doing. 🙂

    Using your custom glass extension, I tried entering the Schott parameters for acrylic that I found here:


    This gives me nd=2.050, Vd=1.64 in RayLab. If I understand what those numbers are, I think they should come out to 1.4914 and 52.6, respectively. At least that’s what the above link says, which matches the refractive index for acrylic according to wikipedia. I also got that 1.4914 number by running the C example code provided at that link, with a wavelength of 587.6nm.

    Any thoughts?

    PS; Your app looks very impressive, to my inexpert eye. I’d like to be able to name my custom glass, and have more than one type, but the basic operation of the app is excellent!

    1. Kamyar Post author

      Hi. I just tried the parameters from the link you provided, and RayLab gave me the correct answers: nd=1.491 and Vd=52.60. Note that three of the coefficients (A1, A2, and A4) are supposed to be negative. If you forgot to enter the negative signs you will get nd=2.050 which is the incorrect.

      Each optical element has an independent Custom glass. For example, if you have two lenses you can define a different Custom glass for each. Being able to provide a name is a great suggestion. I will try to include it in a future release.

      1. Archaeopteryx

        You’re right, I missed the negatives! As I said before, I don’t know what I’m doing. 🙂

        More on my previous suggestion: if it were possible to create and store your own custom glass parameter sets that you could share between lenses it would be much easier to create new lenses and just pick e.g. ‘acrylic’ out of the list. As it is, typing in those six parameters for every new lens is a bit of a pain.

  7. Woody

    I just started using Raylab, and it seems awesome!
    The problem is, after updating it(Oct. 03), it started crashing whenever I try to open up a design. I tried rebooting my iPhone, and reinstallong the app. But it still doen’t work. I’m using iPhone 3GS with iOS 6.1.6. I hope you can fix that soon. Or is it my problem that RayLab crashes?

    Also,I wish you could let me drag lenses freely on the X axis. It just feels weird not able to drag on X axis but freely on Z axis.

    Although I don’t really know how to design a practical lens, I’m fiddling with this app before I start using how to learn Zemax. And still willing to use in the future, mostly because I don’t have to carry a laptop whenever I want to design one. Also, Raylab is pretty easy to use than Zemax.


    1. Kamyar Post author

      Hi Woody,

      I am sorry you are experiencing problems. First question is what build of Raylab are you running? Your email mentions Oct 3 update, but there have been many newer versions since then, with bug fixes and many new features. The current version of Raylab is version 2.17 which was released just a few days ago.

      I mostly test Raylab on iPads with iOS 7. But I also test on iPhone occasionally, and have not seen any issues. If you are still having issues after updating to latest version, I will try to dig in further.

      As far as dragging on X-axis, there is a switch on the model Options window called “Lock to Axis”. If you turn this off you will be able to drag lenses in both dimensions. Also at the bottom of the Surface properties window, there are inputs for x, z, and theta which you can edit directly.


      1. Woody

        Hello, Kamyar

        Thank you for the fast reply!
        For the first problem, it was version 2.17 that I was having problem with. I tried reinstalling and rebooting for about 10 times, and still doesn’t work. Hope if you can fix this thing.

        As regards to the second problem, I should have saw the User’s Guide before asking. Sorry about that.

        One more thing, is it available to make hyperbola, spheric, elliptical mirrors?

        1. Kamyar Post author

          Hi Woody,

          I tried running RayLab on an iOS 6.1 device and saw the crash. The issue is that one of my recent changes works on iOS 7, but is not compatible with iOS 6.1. I have uploaded a patch (version 2.18). It usually takes Apple a week to review and approve a new version. But I have requested expedited review. I am glad you reported this issue.

          With regard to modeling hyperbola, spheric, elliptical mirrors the answer is yes. See the following link:

          Changing K in surface properties window allows you to change surface shape between hyperbola, spheric, elliptical, parabola, etc.

          1. Woody

            Hi Kamyar,

            Thanks for fixing the problem! I can’t wait for the update to be approved by Apple.
            And thank you for the tip, too.

            Lastly, thank you for making such a wonderful app!

  8. Laxus

    I found the Sellmier formula for diamond:
    But when I put the numbers in, the refractive index it gives is way off. Instead of 2.417, or whatever, it gives 2.380. And I don’t see different wavelengths diverging, at all.

    1. Kamyar Post author

      Hi Laxus,

      I just tried the diamond formula, and it works correctly. My guess is that you neglected to square the terms in the denominator. I used K1=0.3306, K2=4.3356, L1=0.175^2=0.030625, L2=0.106^2=0.011236.

      1. Laxus

        Oh, I see. Thank you for clearing that up.

        Yours in Christ,
        Laxus Dreyar

  9. Laxus

    I agree with Archaeopteryx; it would be much easier to be able to define your own catalog of materials than have to input the same numbers in several times for a large system.

  10. Miran

    Hello Kamyar. I updated iOS from 7.1.2 to 8.1.1 on an iPad Air and I think that the “Share” option in RayLab is not working properly anymore (upper right icon). When I press it, it exits the program. I’m using RayLab version 2.29. Any idea what could be the problem? Thank you in advance for your answer.

    The app is great. Keep up the good work.


    1. Kamyar Post author

      Hi Miran,
      I have just submitted a new build of RayLab which should resolve some of the iOS 8 compatibility problems. It usually takes a week for a new build to get approved by Apple.


  11. Viktor

    Can you add 10600nm wave and different lens materials
    I looking modeling co2 laser optics

    1. Kamyar Post author

      Hi Viktor, I will increase wavelength range up to 12um in the next update. You can model most materials using the Custom Glass formulas. Send me a reference for a specific material of interest and I will consider adding it to the catalog.

  12. Clay

    I am very impressed with this software, and will introduce it to all the labs I work with at the university. It is very handy to have a mobile and reasonably priced alternative that functions so well. I am curious how hard it would be to make this work on other OS?

    1. Kamyar Post author

      Thank you for the encouraging feedback Clay. I have been thinking about possible implementations for Android and Mac. But they would each be quite a lot of work. iOS apps are written in a different language than Android. While I can use the same algorithms, I would have to rewrite the entire app in the new language. Developing RayLab is a part time hobby for me, so it would probably take well over six months to do such a rewrite.

  13. Art S

    Hi Kaymar

    Is there any way to customize the shape of the prism?

    I’m modeling a wedge prism for about 10 degrees of deviation.

    I’ll need a wedge angle of about 20 degrees.

    Great program, by the way!

    1. Kamyar Post author

      Hi Art,

      Currently, the prism can’t be customized. But that would be a good enhancement for Raylab. I will put it in my ‘To Do’ queue.

    2. Kamyar Post author

      Hi Art,
      I just thought of a way you may be able to do what you want. Use a normal bioconvex lens instead. Set the radius of curvature for both surfaces to 0 (flat). Then in the property editor for the 2nd surface, set the angle to 10 deg. This will give you a wedge. It is not quite the same as a prism. Only two surfaces will function. Also it is a circular wedge. But it may be sufficient for your needs.

  14. Andreas


    I just started using RayLab, and I am very impressed by the available functionalities.
    But I also found a problem: When I try to change the wavelength range, the second wavelength jumps to 200nm. For instance if I change lambdaN to 850nm, lambda1 jumps to 200nm. When I set lambda1 back to 420 nm, lambdaN jumps to 200nm. In the result I am not able to return to the original visible light range, nor any range not including 200nm.

    I am running on an iPad mini, IOS 8.1.2 RayLab Version 2.33.

    Thanks for any suggestions.

    1. Kamyar Post author

      Hi Andreas,

      Thanks for pointing out this problem. Initially I could not find an issue and the app behaved correctly when I tried this. But I eventually found that this has to do with the Regional setting of the iPad. If you are in a region which uses a comma instead of a period as a decimal point (e.g. France) this problem occurs. I will post a patch which usually takes a week to get approved by Apple. In the mean time you can go to General Settings and change your Region to United States temporarily when using RayLab.


  15. Sergey

    Hello, Kamyar. Thank you for good application! I would like to know Is there any way to:
    1. Save created lenses separetly from model (project) to use them in other model.
    2. Show BFL and EFL surface for lense to correct its positioning on scheme.
    3. Have focus parameter for lenses in addition to lense power.
    4. Have parallel beam source. Currently i was able to find only point source with fan rays. To get parallel source we need to use some lense, but lense can affect quality of the beam. If we use source points with zero angle of fan rays it is impossible to get beam spot diagram or spot diagram(field).

    For future it would be awesome to have:
    Intensity changing through optical system which depends on: Fresnel optics, type of material, polarization, etc…

    Best regards,

  16. Kamyar Post author

    Hi Sergey,

    For #4, you can set the number of source points to a value>1, and set number of fan rays to 1. Make sure the radius of the source surface is >0. This will produce parallel rays. However, it will not produce a 2D spot diagram. I may be able to change that in a future update.

    If you turn on ‘Aim at pupil’ you will see the FFL and BFL surfaces for the entire system (not individual lenses).

    The other questions are not currently possible. I will keep those requests in mind as I add new features.


  17. Linjie Wang

    Hello there.

    Firstly thanks for creating a wonderful, easy to use and educational app for iPad. I am an architect/artist currently designing an optics based art installation, i find your app is very helpful for user who doesn’t have much knowledge about optics. However, I am struggling to take my design into further development due to the app lacks of precisely positioning the lens in 2d and 3d space . i.e. I want layout 12 prisms in a perfect circle to a certain diameter. I also would like to place more than one light source. I wonder if you would implement these functions in the future.

    In the meantime, do you have any recommendations of professional grade desktop applications (preferably mac os x) that can provide a more systematic and precise optics design in 3d and its layout?

    Many thanks


    1. Kamyar Post author

      Hi Linjie,

      Thank you for your feedback. As it so happens I have been working on adding 3D capability to RayLab. Not surprisingly this is quite a bit of work and will take some time before it is ready for release. It could also make RayLab much more difficult to use for a beginner, so I am having to pay close attention to not making the UI too complex.

      With regard to precise positioning in 2D, you should be able to do that by typing x,z,theta values directly into the surface property popup.

      I have also thought about multiple sources and may be adding this in a future release. In the mean time you may be able to get some of what you need by using the multiple configuration manager, and putting the source at different locations in each configuration. You could then quickly switch to different source locations by flipping thru configurations.

      I am not sure about professional optical software on the Mac, but on PCs I have used Zemax, OSLO, and GLAD. They are all quite sophisticated and will take some time to learn. They are also rather expensive.

      1. Linjie

        Thank you Kamyar for your comprehensive reply. I look forward to your future release of 3d capabilities.
        Best regards

  18. Charles

    I enjoy designing with this application. The capabilities meet my current needs.

    Any plans to support a backup and restore capability ?

    I lost my early models due to an iPad crash during an IOS update.

    1. Kamyar Post author

      Hi Charles, You can Backup and Restore your entire iPad using iTunes. What exactly did you have in mind?

  19. Charles

    Thanks for the quick reply.
    The “backup and restore to iTunes” feature was not working on my iPad. So I decided to upgrade to IOS 8.3 to see if that would fix it. Before I did that, I backed up all my other content generating apps through Dropbox or alternative mechanisms that the app provided.
    When I tried to update to 8.3 the program hung, eventually forcing me to do a full recovery on the iPad (thus erasing everything). So I lost the designs I had in RayLab.
    While this is probably an unusual scenario it did happen to me and I point it out to you because an alternative mechanism to archive would have preserved my data.


    1. Kamyar Post author

      Hi Charles,
      I do intend to implement export/import functionality. I do not know yet what form it will take. It could be via mail attachements, iCloud, or Dropbox. This has not been at the top of the priority list, and might be some time before it is implemented.

  20. Jeff


    Does Raylab have the ability to import 3D zemax (.zmx) files?


    1. Kamyar Post author

      Hi Jeff,
      Yes. 3D Zemax (.zmx) files can be imported. The same elements are recognized as for 2D models:

      * The STANDARD, COORDBRK, EVENASPH, FRESNELS, and DGRATING Zemax surface types are recognized in Sequential models.
      * The Standard Lens and Elliptical Volume elements are recognized in Nonsequential models.
      * Glasses are loaded by name and any unrecognized glass is replaced by Custom glass.

      Of course, you need both the Zemax (or Pro) and 3D modeling upgrades to do this.


  21. Brendan

    Really like the app. You should really charge more for such powerful software.

    My feedback:
    This app works well on the iPad pro however the menus are quite large.

    If I could set a threshold before a number was expressed with an exponent that would be nice.

    1. Kamyar Post author

      Hi Brendan,
      Thanks for the great feedback. The Apple developer tools do not have a simulator for iPad Pro yet, so I haven’t been able to do any testing for that device. But I will keep an eye out for the issue you pointed out.

    2. Kamyar Post author

      Hi Brendan,
      I have posted RayLab 3.10 (will probably take Apple a week or so to approve it). It should resolve the UI problem on the iPad Pro along with several other enhancements.

  22. Austin

    Hi Kaymar,

    I’ve just begun using Raylab and have what I hope is a simple question – I have imported a zemax file of a COTS lens I want to use. It’s now in raylab – BUT how do I insert that lens into an existing design? Is there a way to copy/paste it?

    1. Kamyar Post author

      Hi Austin,
      Unfortunately, Raylab does not currently have a copy/paste feature. You would have to look at the parameters of the lens you imported and manually specify them in your new design.

  23. Austin

    understood – and definitely not the end of the world 🙂 OTOH IF you can find time to somehow support this function (possibly just importing directly into an existing design) – I’d pay for this!

  24. Bill

    Hi Kamyar, Nice program! I’m just learning it, and I’m loving it. I have three questions.

    Is there a way to move the stop to different surfaces?
    Can you position the OBJ surface at infinity?
    I would like to design and evaluate telescope objectives. I can flip a design to put the focal plane at the OBJ surface, and then trace the lens backwards. But, to analyze the objective, it appears that I must also have a finite conjugate at the image end. If so, is it presently possible to insert an ideal perfect lens in collimated space before the IMG surface?

    Finally, I would like to put in my vote for an option in the future that would generate a plot of MTF vs. spatial frequency. Ideally, it would comprehend diffraction. A table of the numbers that generated the plot would be nice…in your spare time…I’m sure it’s no trouble… 🙂

    1. Kamyar Post author

      Hi Bill,

      Thank you for the compliment on RayLab.

      RayLab calculates the stop automatically by performing paraxial analysis on the system and checking the radius of the various surfaces. So there is no manual way of designating a surface as the stop. But adjusting the radius of various surfaces will change which surface is the stop. I believe in Zemax you can designate a particular surface as the stop and it can calculate the required aperature for other surfaces. But RayLab does not currently have this functionality.

      At the moment there is not a specific feature for putting OBJ at infinity. I will look into how difficult this would be to add. For now, you would have to get by with using large z values.

      If by an ideal lens you mean a thin paraxial lens element then you can use the ABCD element which RayLab supports.

      Since RayLab is a ray tracing application it may not be too helpful with understanding diffraction. But I have used various tricks to extend its reach beyond simple rays. For example, the ability to view wavefronts is one such functionality. Also, pretty soon I will be releasing ability to model beam splitters and calculate some interference patterns as in a Michelson interferometer. I am not sure about MTF but I will think about it 🙂

  25. Philipp

    Thank you very much for the wonderful software. I use it very sucsessfully in an university course for physics teachers. Both my students and me love the different features, visualisation and easy handling of the app. However we would love to use some of the more advanced features as well and were wondering, if you offered some kind of educational discount.

    1. Kamyar Post author

      Hi Philipp,
      Thank you so much for your interest in RayLab. Following your suggestion, I researched App Store discount features and enabled the volume educational institution discount for RayLab. This provides a 50% discount on volume purchases of 20 or more for the basic app. The App Store does not give developers any flexibility on the parameters for an educational discount. It is either on or off. Unfortunately, I do not see any option for providing a discount for the in-App subscription.

  26. kevin


    Can I use Raylab to calculate lens coupling to fiber ?


    1. Kamyar Post author

      RayLab does not currently have the ability to calculate fiber coupling.

  27. Michael Gilligan

    On very brief acquaintance, I am astonished and delighted by the functionality of this App. — Thank You for the enormous effort that must have gone into developing it.

    My main ‘optical’ interest is photo-microscopy & photo-macrography, so I was pleased to see the Zeiss 40x Objective featured as a sample. … I have to wonder, though: Why does Ray Lab compute its Magnification as -51.3 ?

    1. Kamyar Post author

      Hi Michael,

      It has been a while since I looked at that model and I am hard pressed to say why Magnification is -51.3 instead of -40.
      RayLab is reporting the Paraxial Magnification calculation, and I do know that Zemax also calculates -51.2 as the Paraxial Magnification for this model.

      It may be that there is some aspect of the 40x objective specification from the patent which I am missing. For example, I just noticed that the patent mentions the presence of the 0.17mm cover slide, which is not included in the model.

      Another possibility is that there is a difference between how magnification is defined for a microscope objective and the way paraxial magnification is defined. For one thing the paraxial magnification depends of the distance of the object from the lens. If I increase the distance between the object and first lens surface to 1.556mm we get -40x for paraxial magnification value. I am not exactly sure how Microscope objective magnification is defined. If you do, let me know.

  28. Michael Gilligan


    Thanks for the prompt reply.
    … I have sent you an eMail.


  29. Michael Gilligan


    A quick question:
    What ‘unit of measure’ does RayLab use for Lens Power ?
    … I am confused.

    I have just ‘created’ the Thorlabs plano-convex lens LA1131-633
    This has a nominal focal length of 50mm and a nominal power of +20 Diopter … RayLab shows a focal length of 49.9mm [which is fine], but expresses the Lens Power as .020

    Obviously, I can multiply RayLab’s number by 1000
    … but I am keen to understand why it is expresed that way.

    Thanks and Best Wishes

    1. Kamyar Post author

      Hi Michael,

      In theory (i.e. mistakes on my part not withstanding) RayLab is taking a similar approach to units as Zemax. That is you can use whatever units you want as the Lens Units so long as you remain consistent.

      As with Zemax, Lens units are the primary unit of measure for the lens system. Lens units apply to radii, thicknesses, apertures,
      and other quantities, and may be millimeters, centimeters, inches, meters, etc.

      Being consistent means that Lens Power has units of 1/Lens Units. So if all your dimensions are in mm, then power is in 1/mm.

      The only thing which has a prescribed unit is wavelength which is in nm.

  30. Michael Gilligan

    Thanks for the clarification, Kamyar
    … What you say is indeed quite logical.

  31. Andy

    Hey – really great piece of software. I’d love if I could get MTF analysis, and if I could edit the prescription (like you can in Zemax). Super great!

    1. Kamyar Post author

      Hi Andy,
      I have looked at MTF before and was not quite sure how to compute it for arbitrary lens systems. It would need further study on my part.
      I am unclear what you mean by editing the prescription. RayLab already lets you edit all the lens surface parameters.

  32. Andy

    Huh – I’m not sure how Zemax or Code V computes MTF, but I suppose you could compute the fourier transform of the PSF from the spot diagram?

    As for editing the prescription, I’d like it edit it in the spreadsheet mode rather than per surface.

  33. Adrian

    I love Raylab, thank you for making it! I’m designing a system with an Optotune liquid lens, and was wondering if you can make the focal length a configuration parameter? Also it’s annoying to have to adjust the radius of both faces, a setting to keep them the same would be nice.

    1. Kamyar Post author

      Hi Adrian,
      You should be able to do this already by using Power and Shape Factor fields of the lens.

      Power is simply 1 over Focal Length. And Shape Factor determines the symmetry.
      If you set Shape Factor to 0, then adjusting Power will calculate the radius of both faces of the lens symmetrically.
      With Shape Factor = -1, you get a lens which is planar on one side, while power simply calculates radius for the other side.
      With Shape Factor = +1, the opposite side will be planar.
      Here is a diagram showing shape factor:


      Note that these calculations depend on the index of refraction of the lens.


  34. Douglas Martin

    Hi Kamyar –
    Still loving RayLab. One issue: after the latest update, several of my models cause the program to hang with the following message:
    “3D Model. This is a 3D model. It will not display correctly in 2D layout.”.
    Before the latets update, this message would briefly appear, and then disappear on a tap. Now it remains and I have to close the program from iOS. Any suggestions would be appreciated.

    1. Kamyar Post author

      Hi Douglas,
      I am looking into the issue. I do see the msg appear when the model is 3D and can dismiss it by clicking OK. So the issue may depend on a specific device or iOS version.
      Can you tell me what device you have, and what version of iOS? Also, what version of RayLab is installed? (You can see this by clicking the (i) info button in the toolbar)

      Is the msg appearing for models which you expect to be 2D? Or do you know the model is 3D?
      i.e, is the issue that the message is appearing when you think it shouldn’t be? Or is it that the message is correct but can’t be dismissed?
      I assume you are not using the pro upgrade?


    2. Kamyar Post author

      Hi Douglas,
      I have found the issue and am posting a patch. Build 4.70 should be available in the App Store in a few days.

  35. Valeriy

    Hello Kamyar,
    I am now using a trial of RayLab just to see if it would be useful for me. What I did not found ids just an off-axis cylindrical mirror as an advanced optics. My be I need to use surface shape equation to model it but I am not sure what parameter I have to use in those equation to model a off-axis cylindrical mirror with say 100mm or 200 mm focal length. Your comments or suggestion with this matter will be greatly appreciated and really affect my decision on going with subscription or stay with the free version.

    1. Kamyar Post author

      Hi Valerie,
      Do you just need to move a cylindrical lens off axis? This can be done by turning off ‘lock to axis’ in System Options.
      You can also set the x coordinate of the lens in the lens properties window.
      On the other hand if you are referring to a lens which has been ground off axis, this is not currently supported. Could you point to a spec or a lens drawing online which you are interested in? I may be able to implement this in a RayLab update.

  36. Valeriy

    Hi Kamyar,

    Thanks a lot for a prompt response. Here is the link for one of the mirror i am talking about: https://www.thorlabs.com/thorproduct.cfm?partnumber=CCM254-100-P01
    it focuses the bum just in one plane. Where in the software I can choose the cylindrical mirror option? (I am assuming it is in a parabolic mirror section). What parameter should I input to get cylindrical mirror instead of spherical one?

    1. Kamyar Post author

      I was focused on the mention of ‘off-axis’. But I see that the main issue is that RayLab provides cylindrical lenses but no cylindrical mirrors. I can add a cylindrical mirror in the next update. Although it will have a rectangular outline instead of a circular one. It usually takes about a week before an update is available in the App Store.

  37. Valeriy


    Thanks for your response and I am looking forward for that update that includes a cylindrical mirror option. You did a fantastic job with RayLab. Very useful, powerful and affordable software.

  38. Thomas Cheng

    Dear Kamyar,

    I am Thomas and i’m interesting will you make the app in Windows OS?

    1. Kamyar Post author

      Hi Thomas, I have done some work on porting RayLab to windows. But it has been a lot of work and quite a lot more work is needed before it is done. It would not be ready for quite a while.

  39. Mikael Erkkilä

    Dear Kamyar,

    Great work with this app. I really enjoy playing around with the touch functionality, however, there are a few moments it drives me crazy. I was entering a system prescription from Laikin when I accidentally moved a lens. The work from 15 min was wasted as I had calculated the distances relative to the stop in my head.

    I would suggest a simple fix: Could you add a button called “Protected” next to the “Coarse/Fine” which would turn of the possibility to change this parameter by touch input?

    Best, Mikael

    1. Kamyar Post author

      Hi Mikael,
      Sorry to hear you had that problem. Was there a reason you couldn’t have used the Undo/Redo buttons to restore the position of the lens which was moved accidentally?
      Thank you for the suggestion. I do see the potential benefit of being able to lock the position of some lenses. I will see if I can fit that into the UI in a future update.

      1. Mikael Erkkilä

        I missed the undo/redo buttons 😉 Thx

  40. Michael G

    Hi Kamyar – I have just purchased the full Pro version so that all functionality is enabled. (Thank you for making this available without subscription.) I am trying to set up an a focal system but cannot see how to set my object plane to -infinity (collimated input ray bundle). I can put an ABCD matrix after a finite object to collimating the rays. Is this how I should proceed? Also, do I need to register here to have my questions answered?

    Finally – noticed a bug. I tried to edit the system title (but left author and notes blank) and then enabled ‘Show when model is opened.’ RayLab crashed repeatedly after that, and I could not open the system again without a crash. I had to delete it and start over.

    This is amazing software! Thank you for creating it!


    1. Kamyar Post author

      Hi Michael,

      RayLab doesn’t currently support object at infinity. But you can certainly accomplish it with ABCD matrix as you suggest. Alternatively you can try configuring the object with one fan ray and multiple source points.

      Also, thank you for reporting the bug. You are the second person to report this particular issue. But so far I haven’t been able to reproduce it on my system.

  41. Guanchen

    Hi, I like this idea and the smooth of RayLab, I definitely consider buying the professional version. Besides, it is very moving to see the developer is communicating with customer so actively. As a PhD student working in AMO physics, I would like to see some more professional feature like AOM and EOM whose deflection efficiency can be characterised with input beam size and wavelength. In the lab, aligning a double-pass AOM could be very frustrating and realise it is my beam size or lens focus length are not compatible. Though i can write my program to optimize that, but if RayLab can provide such professional features , I would bring my Ipad into lab as a professional tool!

    1. Kamyar Post author

      Hi Gaunchen, To clarify are you referring to atomic/molecular/optical physics or to acousto-optic modulators? If you point me to some references to the types of models you are interested in I can see if they would be feasible in RayLab. Atomic/molecular optics certainly seems to be quite far removed from RayLab’s capability, but acousto-optic modulators might be reasonable.

  42. Guanchen

    Hi kamyar,

    Thanks for the quick reply.

    Indeed I am working on area of atomic-optical-molecular physics, but the featue I suggested is Acousto-optical modulator. A specific guide I have used to learn how to align Acousto-optical modulator is https://pdfs.semanticscholar.org/9058/09436bc6a2fb3593f98a3c0bddeda35260ad.pdf. And another useful information is here http://www.isomet.com/App-Manual_pdf/Maximizing%20DE.pdf.

    Other feature might be feasible is to use gaussian-optics to simulate light in a cavity and light coupling into a fibre.


    1. Kamyar Post author

      Hi Guanchen,
      I looked at the references which you provided. From what I understood an acousto-optic modulator seems to behave very much like a transmissive diffraction grating. RayLab does have a model for transmissive gratings which you could use. You would of course need to specify the grating pitch which is equivalent to that of your modulator. However the diffraction grating model does not calculate the fraction of power in the deflected beam. This is true for most of RayLab which usually does not track the ray intensity thru the optics. An exception to this is when using Ray Splitting mode which computes transmission and reflection intensities using Fresnel equations.

      For Gaussian beams RayLab does offer tracing of Gaussian beams using complex beam parameter. To get this to work reduce the number of rays to 1, and specify the rays initial w, z, and M2. Then turn on Gaussian Spot size Analysis window. You can check the sample model ‘Optical Resonator’. The primary limitation of using complex beam parameter analysis is that it assumes the aperture of the optics is large enough not to clip the beam. As far as I know, modeling beams which might be clipped by the optics requires full physical Beam Propagation Methods BPM which are beyond RayLab’s current capability. It would be feasible to compute a coupling efficiency between the Gaussian beam computed in RayLab and the mode of an optical fiber. I used to do this when working on designs for telecom fiber optic switches. But would this be of much use for you if the model doesn’t account for clipping of the beam and other effects which require BPM?

      1. Guanchen

        Hi Kamyar,

        Thanks for the efficient reply, yes AOM mostly works as a diffraction grating, except it shifts the frequency of light slightly even the incident one is monochromatic. I guess transmisve grating probably be okay to find out the a suitable lens combination for my purpose for a Gaussian beam. I didn’t realise that RayLab provide a transmissive grating, I only see the component of diffraction grating that I assume it is a reflective grating.

        For fibre coupling simulation and other purpose, I genuily would make my beam not clipped as much as possible. So perhaps, only consider non-clipped situation is good enough.

        By the way, I am still amazed by your Fresnel Feature. I sincerely hope RayLab could be welcome by many students even professionals:)


  43. Robert Taber

    RayLab is a remarkably useful tool. I purchased the bundle for use on my iPad, and after working with it for a while, I would gladly pay ten times as much to have a copy that would run on either a Windows PC or a Mac computer. As of now, RayLab has saved me more than that amount in Thorlabs lens purchases. I suspect that a PC version will require an enormous amount of effort, and I saw your comment about starting to work on it. I won’t be surprised if it takes quite a bit more time.
    Until then, for my work, an extremely valuable upgrade would include the ability to save the system description in a text file (probably with a format inspired by Zemax) combined with an ability to read in a system definition from a text file. This would enable a tremendous variety of activities, including workaround solutions to problems that can’t currently be addressed. The ability to create text files containing any of the various reports (Ray Report, Optimization Report, etc.) would also have great value. In view of the iPad environment, perhaps these text files could only go to or from email attachments – that would not be a terrible compromise. Or maybe the transfer could go by way of the clipboard; that would supply good flexibility. You could potentially sell the text file interface as a separate license.
    Another iPad issue: On my iPad, the “Surface Properties” menu covers the righthand 1/3 of the screen and it is semitransparent, so it is sometimes very hard to read the contents of the various menu entries. I have learned that it is possible to orient the optical system with its long-axis aligned vertically, and that mitigates this problem considerably. But I find it necessary to re-orient all of the components “by hand.” Due to good design foresight on your part, most of the surfaces associated with each other all tilt together. However, it would be advantageous if this could somehow be declared as the default orientation. When everything is oriented vertically, the Surfaces Properties menus is much easier to work with.
    Another topic: So far, all of my spot diagrams come out with a single color, no matter how I color-select the rays themselves. It would be very helpful if the spots had matching colors. Also, the Ray Report seems to only report a subset of the rays that are computed. As I see it, each ray selected in the object menu gives rise to a conical distribution of associated rays, but I don’t see how to obtain numerical information about all of them.
    Anyway, congratulations on an excellent, extremely useful product.

    1. Kamyar Post author

      Hi Bob,
      Thank you for your kind words, and for your suggestions. Your raise quite a few points and I’ll try to respond to them all.

      I did explore supporting Raylab on other platforms. As you suspect it is quite a lot of effort to do so and it requires rewriting much of the code. I have made quite a lot of progress towards a web version of the app which has the advantage of being usable on any device, Mac, Windows, Linux. Unfortunately I do not have a specific timeline of when it may be ready for release.

      Originally Raylab saved the system description in a binary format which was fairly specific to how things are usually done in iOS. But I switched this to a JSON text format some time ago mostly with the intent of being able to use the same format on Mac and Windows. I can probably come up with a way to import/export this file via mail attachments as you suggest.

      With regards to the orientation of the model, I think it is fairly standard to set up the optical elements along the z axis, and to show this axis going to the right. Rather than reorienting all the components by hand, I would suggest that you continue to place the components along the default axis. But then rotate the entire view so that axis is pointing up. This change in orientation is not currently supported in the 2D view. But it is supported in the 3D view. When you are in 3D view you can double tap on the screen. Doing so will transition to one of 3 standard views. Double tap again and it will go to next standard view, and so on. One of the standard views has the grid oriented similar to the 2D view. Once you are in this view you can use two fingers to rotate the view to the orientation you want.

      I can see what you mean with the Spot Diagram. The app always colors the spot diagram by wavelength color which made sense to me at the time. It looks nice in the ‘Sample – Coma Abberation’ model. But I can see the merit of changing this to follow the ray coloring option.

      Raylab can perform ray tracing in 2D and 3D. When in 2D it traces fewer rays than when in 3D even with the same number of sources, fan rays, etc. For example FanRays=3 generates 3 rays in 2D, but 19 rays in 3D. In 2D the value 3 actually specifies number of rays. But in 3D it specifies number of cones of rays. I think what you are seeing is that even when you are in the 3D view, the ray report shows the 2D rays. This was intended to reduce the length of the reports, mostly because the reports are refreshed every time the model is updated, and if it is too long Raylab becomes unresponsive. I might need to add a static report that does not continually refresh. Such a report could be much longer without causing issues with responsiveness.

      Thank you for you suggestions. I will try to include at least some of them in an up coming update.


  44. Robert Taber

    You have made Raylab into a powerful tool, and one of its key advantages is that it is still quite easy to figure out how to use it. According to that, it is not a good idea for me to make suggestions that would make the user interface too cluttered or to make suggestions that are really only relevant to people who have a particular style of usage.
    With that restriction in mind, I still have two suggestions:
    1) (related to one prior suggestion) when the “Surface Properties” menu appears, it would be highly advantageous if it were opaque. On my iPad (iOS 12.5.4) the Surface Properties menu is transparent and that often makes it extremely difficult to use. Due to the visual interference, I can end up clicking on the wrong entry – things go bad from there.
    2) It would be advantageous to have a master on/off switch for the optimizer. When I want to make two or more “coordinated” changes of the dimensions, the optimizer sometimes gets highly excited by the first change and even if I make a second, compensating one, it becomes lost and can’t find its way back. This is expectable behavior, and the simplest solution I can see would be to just switch it off until I hand tune the system to an approximation of a good solution. Maybe there is already something available that accomplishes this on/off function, but I have not been able to find it.

    An additional note about ray tracing reports: For me, the value of reporting a large number of rays would only be obtainable if I can export the ray report, so keeping the “live” ray tracing report limited in number would not present a problem as long as the full set is exported.
    Thanks again for a valuable tool

    1. Elias Kristensson

      Hi Kamyar,
      Thanks for a great software! Would it be possible though to add spectral filters where the user inputs the wavelength the filter can transmit?


Leave a reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.