Page 1 of 4

Optics in FreeCAD

Posted: Sat Sep 20, 2014 4:02 pm
by DeepSOIC
Hi
I want to share some tricks (building blocks) for optics design. With the ellipse support that is coming, FreeCAD looks like a promising tool for simple optics design.
I have only two right now, but maybe more will come later

Re: Optics in FreeCAD

Posted: Sat Sep 20, 2014 4:50 pm
by DeepSOIC
Here's another one, a bit more interesting: simulation of a thick lens.
This lens was drawn by accident and wasn't actually engineered. It is here just to demonstrate that one can simulate a ray passing through it.

Re: Optics in FreeCAD

Posted: Sun Dec 14, 2014 12:00 am
by DeepSOIC
I have written a built-in Snell's law constraint for the sketcher, and playing with refraction has just become very easy.
ellipsoid-spherical lens at an angle.png
ellipsoid-spherical lens at an angle.png (175.61 KiB) Viewed 26187 times
This lens perfectly focuses a parallel beam of light into a point when it's along optical axis, but sucks at focusing the beam when it is at an angle. Does this explain why human eye has poor peripheral vision :roll: ?

To use the model, FreeCAD with the constraint is needed. You'll have to compile it from my branch, or use my Windows build (and possibly get my viruses ;) ). Check out Optical constraints development forum thread for the links.

If anyone wants to see this in master, please let me know.

Re: Optics in FreeCAD

Posted: Sun Dec 14, 2014 3:21 pm
by cox
I find your work fasinating and wold definitely like to see it in master.

Thank you for sharing

Keep up the good work.

Re: Optics in FreeCAD

Posted: Sun Dec 14, 2014 11:45 pm
by DeepSOIC
Thanks cox!

Re: Optics in FreeCAD

Posted: Thu Mar 16, 2017 10:50 pm
by DeepSOIC
My first ever attempt at ray-tracing. I gave a try to OCC's super new CAD Rays.

I mocked up a scene, with a lens I thought I designed to focus perfectly...
lens scene cad.png
lens scene cad.png (30.69 KiB) Viewed 23788 times
And I tried to render it, in hope to see the image of objects in front of the lens. But all I got was lots of stray light, and no actual image. Then I removed the objects, and placed a light source. At first, I got something strange and very slowly, but I realized I forgot to switch off the sun :mrgreen: , and after doing that...
lens scene.png
lens scene.png (642.63 KiB) Viewed 23788 times
To my disappointment, the result is still very noisy after a few minutes of waiting. :( But it definitely shows something useful. It demonstrates that my lens is very far from perfect. All that halo around the image...

So I went back to FreeCAD, and checked the design. Sure enough...
lens scene lens design.png
lens scene lens design.png (414.16 KiB) Viewed 23788 times
It's definitely cool to see stuff like this! But I'm not happy with the UI of CADRays. It's strange. Moving around is hard. It often becomes very laggy, so I have to switch over to opengl rendering. It doesn't like touchscreen input, and even with pen, I often find out CADRays decided I want to drag the wrong numberbox, or reset my hue value of color, or not accept light source power below 1.0...

I want gesture navigation style from FreeCAD to be in there! I still have not figured out how to pan! (apart from AWSD)

Re: Optics in FreeCAD

Posted: Thu Mar 16, 2017 11:27 pm
by DeepSOIC
Now we are talking. Rectified my lens design, focuses perfectly!
correct lens.png
correct lens.png (304.83 KiB) Viewed 23770 times

Re: Optics in FreeCAD

Posted: Fri Mar 17, 2017 12:12 am
by kkremitzki
Now that's pretty dang cool! 8-)

Re: Optics in FreeCAD

Posted: Fri Mar 17, 2017 12:37 am
by DeepSOIC
Got an image of some stuff through the lens!
lens-scene 2 render.png
lens-scene 2 render.png (261.71 KiB) Viewed 23754 times
On AMD Radeon 7700 and with regular mouse, CADRays is behaving much much better, and makes a nice rendering faster.

Re: Optics in FreeCAD

Posted: Fri Mar 17, 2017 4:42 am
by ian.rees
Bonus points for hooking this up with FEM and melting something with focused light ;). -Ian-