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
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

Szzer wrote: Thu Feb 03, 2022 10:43 am How did you manage to get a measurement Thschrader?
There is a counter in every mirror, lens and absorber object that counts the number of hits of a ray
Image
User avatar
Szzer
Posts: 71
Joined: Wed Dec 26, 2018 1:26 pm

Re: Optics Workbench

Post by Szzer »

that counter might be just the ticket! Ill give it a try.
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: Optics Workbench

Post by drmacro »

I'm a total noob tinkerer with optics, so this is probably obvious. :oops:

I have a lens, with a measured focal length.

I googled around an found refraction index = (FL/radius of curvature) + 1

The ray traces I did by hand seem to confirm the FL measurement is correct.

But, I can't seem to get the ray from the Optics workbench to match the image plane.
So, setting the Lens object property Ref. Index to the calculated value.
My method of measuring the radius of curvature could be off as well, but, I don't think it's off enough to cause the ray to cross more than 2X further than I think it should.

Am I just generally off in the weeds? :mrgreen:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
Szzer
Posts: 71
Joined: Wed Dec 26, 2018 1:26 pm

Re: Optics Workbench

Post by Szzer »

christi wrote: Sat Feb 05, 2022 8:37 am There is a counter in every mirror, lens and absorber object that counts the number of hits of a ray
I tried this, and indeed it is possible to get the count an estimate of the elumination of the surface.
There is a problem with this approach though. When using a sperical beam, the distribution of the rays is not uniform. This means that the denser sections of the radiating beam has a larger influence on the beamcount than the lower sections...
ray distribution not uniform.png
ray distribution not uniform.png (78.32 KiB) Viewed 2470 times
I have found an article that describes how to evenly dirstribute points on the surface of a sphere, maybe this might solve it:
https://www.cmu.edu/biolphys/deserno/pd ... e_equi.pdf
User avatar
Szzer
Posts: 71
Joined: Wed Dec 26, 2018 1:26 pm

Re: Optics Workbench

Post by Szzer »

I managed to implement the paper that i sugested in the previous post:
ray distribution uniform.png
ray distribution uniform.png (35.15 KiB) Viewed 2434 times
I'll attempt to make a pull request (never attempted that before) such that the developers can check if the horrible mess i made from the code is acceptable.

--Update:
I made a Pullrequest with my improved 3d point ray cloud:
https://github.com/chbergmann/OpticsWorkbench/pull/25
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

Szzer wrote: Tue Feb 08, 2022 4:19 pm I managed to implement the paper that i sugested in the previous post:
This is a good improvement for the 3D spherical beam.
Thank you.
User avatar
christi
Posts: 203
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

drmacro wrote: Sun Feb 06, 2022 8:27 pm I googled around an found refraction index = (FL/radius of curvature) + 1
Well, I think you googled bullshit. The refraction index depends on the used material and wavelength. It is independent from the radius of curvature.
To calculate the refracted ray, use Snells law
drmacro
Veteran
Posts: 8865
Joined: Sun Mar 02, 2014 4:35 pm

Re: Optics Workbench

Post by drmacro »

christi wrote: Wed Feb 09, 2022 5:53 pm
drmacro wrote: Sun Feb 06, 2022 8:27 pm I googled around an found refraction index = (FL/radius of curvature) + 1
Well, I think you googled bullshit. The refraction index depends on the used material and wavelength. It is independent from the radius of curvature.
To calculate the refracted ray, use Snells law
Thank you for your kind advice. It was...well, never mind what it was. :roll:

After more thought and careful reading, it is clear I had not fully thought through what I was attempting to do or ask. (in addition to just beginning to dabble in optics)

Since I have a rather large collection of unknown lenses, I can determine their radius of curvature and focal lengths (within tolerance good enough for my purposes) and with the lens makers equation determine the refractive index. I have seen no other way to use the workbench, if the index is not known.

So, the lens makers formula 1f=(n−1)(1r1+1r2) to find the refractive index n of the lens.

Once I realized I had messed up the radius curvature measurements and corrected that for a couple test lens, the graphical parallel ray method on paper indeed appears to coincide with the results from the workbench.

I never doubted the workbench. I certainly did doubt my understanding of texts I'd read and capability to use the workbench to verify my, by hand, results.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
Szzer
Posts: 71
Joined: Wed Dec 26, 2018 1:26 pm

Re: Optics Workbench

Post by Szzer »

christi wrote: Wed Feb 09, 2022 5:43 pm This is a good improvement for the 3D spherical beam.
Thank you.
great, happy to help a little
User avatar
Szzer
Posts: 71
Joined: Wed Dec 26, 2018 1:26 pm

Re: Optics Workbench

Post by Szzer »

I created an commit for adding an extra feature to the Spherical ray.
I wanted to simulate the light trajectory of a led light. By using a spherical ray most of the rays are lost since the led has a directional point source. Thus a lot of computingtime wasted on calculating rays that are not used for the analysis.
So I created a additional parameter for the spherical ray, called "Cone angle".
This transforms the spherical ray to a cone shaped ray (still equally distributed ofcourse.)

maybe something to add in the workbench (did a pullrequest already).

left the cone ray, right the spherical ray (default).
Image of cone vs spherical ray.png
Image of cone vs spherical ray.png (22.13 KiB) Viewed 2137 times
Post Reply