Skip to content
polychromsPublic

About

light raytraced simulation in rust

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

LightLab

Precision 2D & 3D scientific optics studio and headless CLI written in Rust (f64 physics + Obsidian Glass eframe/egui GUI).

Capabilities

  • Exact Sellmeier / Ciddor Dispersion: Published glass dispersion & group-index $n_g(\lambda)$ models for N-BK7, N-F2, N-SF11, Fused Silica (SiO2), N-LAK9, CaF2, Water, Diamond, Air (STP), Vacuum, plus custom Cauchy (n_d, V_d).
  • Conic, Even-Asphere & Cassegrain Geometry: Double-precision (f64) analytical & Newton-Raphson ray intersection for spherical, parabolic ($K=-1$), elliptical, and hyperbolic conics, even-asphere polynomials ($A_4 y^4 + A_6 y^6$), Cassegrain central-bore mirrors, thick singlets, 3-surface cemented achromatic doublets, dispersive/TIR prisms, beam splitters, aperture stops, transmission/reflection gratings, waveplates/polarizers, and detectors.
  • Real 3D Mode & Studio Spectral Raytracer: True 3D skew-ray optical tracer with out-of-plane z, pitch, and prism extrude_half_z transforms, 2D (Δy, Δz) detector spot diagrams, and a multi-threaded progressive spectral path tracer (CausticMap continuous 390–705 nm photon-mapped rainbows & Fresnel ribbons, hero-wavelength dispersion, thin-lens DoF bokeh, HDR optical bloom + ACES tone mapping, and Breadboard / BrightStudio / Darkroom / Void backdrops).
  • Full 4×4 Mueller-Stokes Polarization & Coherent Interferometry: Tracks $[S_0, S_1, S_2, S_3]$ across dielectric Fresnel interfaces (Brewster $R_p = 0$, TIR Fresnel-rhomb phase retardance), Linear Polarizers (exact Malus's law), $\lambda/4$ & $\lambda/2$ Waveplates (optical isolators), and coherent phasor superposition on Detectors ($\text{OPL} = \sum n_k d_k$).
  • ABCD Paraxial Solver & Built-In Optical Optimizer: Cascaded $2\times 2$ Gaussian matrix ($\det = 1$, EFL, BFL, FFL, $H_1/H_2$, $F_1/F_2$, Cassegrain two-mirror support), closed-form minimum-RMS best focus, Airy diffraction limit, LSA/TSA, Fraunhofer $F$–$d$–$C$ LCA, Wavefront OPD & Maréchal Strehl ratio, plus one-click Coddington Lens Bending and Aspheric ($K_1, A_4, A_6$) optimizers.
  • Obsidian Glass Studio GUI: 14 categorized presets, 2D Bench & Progressive 3D Raytrace toggle (3), Undo/Redo (Ctrl+Z/Ctrl+Y), interactive Ruler/Protractor (M), iso-OPL Wavefront crests (W), Dispersion $n(\lambda)$ & Fresnel $R_s/R_p(\theta)$ plots, and direct .svg / .png / .csv / .txt / .json export.
  • Ergonomic Headless CLI: Compose benches, inspect glass datasheets, optimize lenses, print 2D/3D reports or JSON, and render publication-ready vector .svg or spectral raytraced 3D .png diagrams without a display server.

Quick CLI Examples

lightlab                                  # Launch Obsidian Glass Studio GUI
lightlab --help                           # Full CLI reference
lightlab --list-presets                   # List all 14 scientific presets
lightlab --list-glasses                   # Optical glass datasheet table
lightlab --glass-info nbk7                # Detailed Sellmeier & group index table
lightlab -p cassegrain --report           # Headless Cassegrain telescope report
lightlab -p periscope_3d --3d --export-png periscope_3d.png
lightlab -p studio_prism_caustic --3d --spp 24 --export-png studio_prism.png --size 768x1152
lightlab -p 1 --optimize bending --optimize asphere --report --export-svg asphere.svg
lightlab -p prism --export-png prism.png --size 1920x1080

Build, Test & Package AppImage

cargo clippy --all-targets -- -D warnings
cargo test --release
./packaging/build-appimage.sh

The AppImage is generated at dist/LightLab-2.1.0-x86_64.AppImage.

About

light raytraced simulation in rust

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages