WebGL2 3D Implicit SDF Optical Bench, 7-Band Cauchy Dispersion Caustics & Stereo Beating Overtone Prism
Solo Self-Initiated Work · Part II of the Perceptual Computation pure-code media series
From Measuring Light (COLLIMA) to Sculpting Light — Instead of discarding off-axis coma, astigmatism, chromatic dispersion, and Total Internal Reflection as optical defects, Caustic Collimation turns a 3D signed-distance optical bench into a real-time audiovisual sculpture instrument.
-
5 Lipschitz-Safe 3D SDF Optical Archetypes (
src/optics/shaders.ts&src/optics/sdfMath.ts):-
Biconvex Crown Singlet (
N-BK7): Exact sphere-sphere-aperture CSG intersection. -
Negative Meniscus Flint (
SF11): Convex-concave sphere difference with rear shell cap. -
Even-Order Aspheric Lens (
N-BK7): Conic + polynomial sag$z_{\text{sag}}(r) = \frac{c r^2}{1 + \sqrt{\max(0.01, 1 - (1+\kappa)c^2 r^2)}} + \alpha_4 r^4 + \alpha_6 r^6$ . -
Dispersive Flint Prism (
SF11): Exact 3-halfspace prism SDF exhibiting both rainbow dispersion and internal critical reflection. -
Cylindrical Anamorphic Lens (
N-BK7): Orthogonal tangential/sagittal Sturm astigmatic focal lines.
-
Biconvex Crown Singlet (
-
3D Vector Snell Refraction, Schlick Fresnel,
$k_{\text{TIR}} < 0$ TIR & 7-Band Cauchy Dispersion:- Evaluates
$n(\lambda) = A + \gamma_D B / \lambda^2$ across 7 wavelengths (420, 460, 500, 545, 590, 635, 680 nm) for SchottN-BK7($A=1.5046, B=0.00420$ ) and dense flintSF11($A=1.7432, B=0.01342$ ). - WebGL2 Transform Feedback sphere-traces
672stratified multi-bounce rays per step (67,200rays during the synchronous100-step boot warmup) with additive Tyndall beams, analytical Bessel Airy diffraction rings$(2 J_1(\rho)/\rho)^2$ , and automaticEXT_color_buffer_float(RGBA16F → RGBA8gl.NEAREST) fallback.
- Evaluates
-
7-Partial Stereo Additive Overtone Prism (
public/worklets/caustic-prism-processor.js):- Maps the 7 optical wavelengths to harmonic partials
$f_0 r_k$ ($f_0 = 110\text{ Hz}$ ,$r_k \in {1.0, 1.5, \dots, 4.0}$ ) with tilt-driven chromatic phase beating$\Delta f_k = 5.5,\frac{n(\lambda_k)-n(\lambda_3)}{n(\lambda_3)-1},\Theta;\text{Hz}$ (0.00 Hzcrystal consonance when collimated at$\Theta = 0$ ).
- Maps the 7 optical wavelengths to harmonic partials
-
[P]Beer-Lambert Archival Lithograph Mode & Deterministic Plate Exporter:- Renders
#F6F4EFAlabaster Lithograph geometric ray cross-sections with#141619Pine Soot,#1B3B5FPrussian Blue,#9E6B2BMineral Ochre, and#C83E2BCinnabar inks, pluswindow.__renderArchivalPlate(plateId, width, height)for deterministic monograph export (caustic-hero,caustic-schematic,caustic-tilt-matrix,caustic-thumb).
- Renders
| Input / Query Parameter | Action |
|---|---|
| LMB Drag on Lens | Translate optical element along the bench axis and lateral plane |
| Wheel / Tilt Control | Induce off-axis tilt |
1 – 5 |
Switch optical bench presets (1 Off-Axis Coma · 2 Double Flint Prism · 3 Anamorphic Astigmatism · 4 Collimated Quartet · 5 Grazing TIR Cavity) |
P / ?print=1
|
Toggle [P] 2D Geometric Ray-Tracing Lithograph mode (Escape exits) |
M / Audio Pill |
Unlock 7-partial beating overtone prism on first gesture (150 ms ramp) |
?lang=en | ?lang=zh-HK
|
Interface language (en default) |
?seed=<u64> |
Bit-exact 64-bit Rng64 Xorshift64* seed (default 1468) |
?preset=<1..5> |
Boot into preset 1..5
|
npm ci
npm run dev # Local Vite dev server (http://127.0.0.1:4111)
npm run build # Strict TypeScript check + relative-base Vite production bundle -> dist/
npm run preview # Serve production dist/ locally| Work | Title | Medium & Algorithms | Live Interactive Work |
|---|---|---|---|
| 01 | MORPHOS // 菌脈・聲場 | WebGL2 Gray-Scott PDE · 262k GPU Physarum · Async PBO AudioWorklet · [V] 3D Gallery |
Launch ↗ |
| 02 | CAUSTIC COLLIMATION // 光軸與焦散 (this repo) | WebGL2 3D Implicit SDF Optical Bench · Snell/TIR · 7-Band Cauchy · Beating Overtone Prism | Launch ↗ |
| 03 | POLYGLOT DRIFT // 語流・字陣 | Zero-Asset HK CJK Canvas2D · WebGL2 1+JFA SDF · O(KN log N) Sliced OT · 3-Formant Audio |
Launch ↗ |
| 04 | COLLIMA // Seeing Before the ISP | Rust 2024 + WebAssembly · 14-Bit Synthetic .DNG · Pre-Demosaic WLS Tilt & HCG Noise Lab |
Launch ↗ |