Optics Workbench

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Optics Workbench

Post by Kunda1 »

PJT wrote: Mon Jan 10, 2022 12:56 pm Hello. Thanks for making this really nice tool. I am starting to learn how to use it.
Hi @PJT, are you planning to use Optics in PUMA? That would be sweet!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
PJT
Posts: 33
Joined: Sun Aug 15, 2021 9:39 pm

Re: Optics Workbench

Post by PJT »

I wanted to simulate some aberrations to see if I can design correction plates for the PUMA beam splitters. So far I am just getting used to using it. It is the only free simulator I have seen that allows me to see colour dispersion. So - good for chromatic aberration in single rays. However I am not sure if it can help with more complex aberrations such as spherical aberrations in 2D images (3D beams) so I am just exploring what it can do for now. Not sure if I will be able to design any affordable correctors for PUMA - with any software - but this optics workbench is a very nice simulator anyway for anyone playing with optics. Up till now I have used the Google Chrome plugin 'Ray Optics' app but that doesn't do colour.
User avatar
PJT
Posts: 33
Joined: Sun Aug 15, 2021 9:39 pm

Re: Optics Workbench

Post by PJT »

I figured out how to move a SunRay - select all 100 rays then do a 'Placement' op - seems to work.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Optics Workbench

Post by joha2 »

Hi Christi,

Thank you for sharing the insights into your Optics Workbench, too, and pointing me to the code!
christi wrote: Thu Jan 06, 2022 2:55 pm - Create a line (ray) with infinite length
- Find all intersection points with any FreeCAD geometry
- Find the nearest intersection point that is part of an OpticalObject (=lens, mirror or absorber)
- Create a mirrored or refracted ray with the help of the normal vector on the intersection point
This seems to be a bit of another approach than we use in pyrate, since we have a strictly sequential raytracing where the user gives a list of surfaces which should be hit by the rays in the given order. In your case it seems to be more a non-sequential raytracing (i.e. trace all rays which hit some object somewhere). Do you also follow the refracted/reflected rays recursively until a distinct recursion depth?
christi wrote: Thu Jan 06, 2022 2:55 pm You can get all surfaces of a FreeCAD object if you loop through Shape.Faces. Each face has a surface component, but there are many different types of surface. See section GeometrySurface(Geometry) in Part.html in the automatic Python modules documentation. The conversion should be simple if the FreeCAD type equals a surface type in pyrate.
Thanks for the hints, I knew that such functions exists, but forgot their names :D I think I would use FreeCAD the other way around: Instead of mapping the FreeCAD surfaces (i.e. faces) to existing pyrate surface classes, we would implement a new surface type (FreeCAD surface) which encapsulates the face and implements the necessary methods (intersect, refract/reflect, getSag, ...) and group them into a class derived from the OpticalElement class, such that a FreeCAD shape provides a 1:1 correspondence to an OpticalElement in pyrate. At the end the implementation of such objects wouldn't be too difficult, but the mixing between pyrate surfaces and FreeCAD derived surfaces is maybe difficult.

Best wishes
Johannes
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

joha2 wrote: Sat Jan 15, 2022 11:01 am Do you also follow the refracted/reflected rays recursively until a distinct recursion depth?
Yes. There is a parameter MaxNrReflections in each ray. The default is 200.
tbr
Posts: 1
Joined: Tue Jan 18, 2022 7:23 am

Re: Optics Workbench

Post by tbr »

Hi,

Great workbench! Thanks for sharing it.

I've been trying the workbench while using cemented achromats, i.e. two lenses of different refractive index that are in physical contact. The .step file I get from a commercial supplier (e.g. https://www.thorlabs.com/thorproduct.cf ... C508-150-A).

I noticed that at the interface between the two glasses, the refraction is not correctly calculated. It seems to me that the index of the second material is taken as 1 when calculating the refraction angle.

As a test, I moved the two lenses apart such that an air gap exists between then. In that case the refraction is calculated correctly.

Is this a known issue? Is an air gap required between two optical elements?
User avatar
Boogieman
Posts: 34
Joined: Wed Apr 18, 2018 9:03 am

Re: Optics Workbench

Post by Boogieman »

Hi,

yes there has to be at least a tiny gap, so that the light ray leaves the first lens before it enters the other one.
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

tbr wrote: Tue Jan 18, 2022 7:30 am Hi,
I noticed that at the interface between the two glasses, the refraction is not correctly calculated. It seems to me that the index of the second material is taken as 1 when calculating the refraction angle.

As a test, I moved the two lenses apart such that an air gap exists between then. In that case the refraction is calculated correctly.

Is this a known issue? Is an air gap required between two optical elements?
I added support for adjacent lenses and lenses inside lenses.
You do not need an air gap between two lenses any more
User avatar
Szzer
Posts: 71
Joined: Wed Dec 26, 2018 1:26 pm

Re: Optics Workbench

Post by Szzer »

thschrader wrote: Sun Jul 18, 2021 3:47 pm Played a little bit with optics:
Draft-wb snapping works for every ray. You can construct faces, lets say for
energy-loss calculation.
With curves-wb you can extract single rays for further calculations.
Fascinating stuff, congratulations!
optics_play.JPG
I've started to use the optical workbench for creating a lightguide to transport light from a led (placed on a pcb) to another location of my device.
It would be awsome to be able to get a measurement for the light intensity on an (absorber)object, even cooler would be a intensity distribution across an (absorber) object.

How did you manage to get a measurement Thschrader?
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Optics Workbench

Post by thschrader »

Szzer wrote: Thu Feb 03, 2022 10:43 am ...
How did you manage to get a measurement Thschrader?
You can draw a face wich contains all beams at point 1+2.
The areas can be measured with the "survey"-tool from arch-wb (the blue helmet).
The left/lower tip is always located at the center of gravity (COG).

Lets say you have a light intensity of 100 lumen/0,16 mm^2 = 625 Lux at point 1,
the light intensity at 2 should be 625/37,85=16,5 Lux.
You compare the areas, that was the idea.
I am not an optics-geek, at the moment, optics-wb is not installed.
Hope that helps.
pic_from_page6.JPG
pic_from_page6.JPG (55.37 KiB) Viewed 2950 times
arch_WB_survey_tool.JPG
arch_WB_survey_tool.JPG (48.91 KiB) Viewed 2950 times
Post Reply