A Mitsuba based script that solves for Diamond Turning Machining optimized surface geometry to project a caustic image.
Download Mitsuba example scenes to run.
NOTE: This is mainly used for notetaking and library is mostly nonfunctional in terms of the scope. The Optimal transport math initializes geometry correctly at a reflected 45deg angle. This library is mainly used for analysis of the produced geometry among other notes but the differentiable optimization has yet to produce any desireable effects beyond the OT geometry.
If you are looking for reflective/refractive caustic surface generation in general check out this other repo: https://github.com/dylanmsu/fast_caustic_design
The scripts contained in this library contain various notes and concepts on how to turn OT initialized geometry into finalized high contrast/ spatial frequency caustic images into a manufacturable surface. No generalized solution is formed.
The overall boilerplate code in this script in theory could be assembled into a functioning version of a optimization pipeline outlined in the paper below if the following was completed:
- The OT initialization geometry needs to be converted into python instead of C++ and integrated into the differentiation pipeline
- The differentiable optimization loss function needs to be developed to consistently produce high contrast caustics (Many various loss functions are described in the optimizer script)
- Finally for manufacturability a loss function that describes swept surface tool clearance orthogonally along the tool radius as well as in the conical clearance face direction along the spiral or raster (etc.) toolpath direction need to be implemented into the surface generation before OT initialization.
- If you do all that pls message me I would want to mess around with the tool. Manufacutring the finalized surface geometry to nanometer form accuracy is more accessible to me than the time needed to implement the rest of the code :(.
Paper describing end goal: https://dl.acm.org/doi/10.1145/3732284
There are many other more functional implementations of these concepts but hopefully there might be some useful ideas/code in here.
Example image showing base heightmap before and after filtering for DT surface profile.

Nanocam surface profile after export into XYZ 3d Surface.

Tool clearance violations before optimization.

Surface profile extremes shown in Ansys SPEOS before toolpath smoothing optimizations.

Tool clearance violations after optimization.

Verified surface projection result in blender.

As an overview this script is not finalized in its form of generating Diamond Turning machinable surfaces other than initializing the geometry to achieve the desired caustic image. The next steps would include initializing the starting geometry with an optimal transport problem and then during the differentiable optimization merit function include swept surface tool clearance loss functions.
