Overview
The AgeSwitch AI Biometric Simulation Lab represents an advanced interactive platform designed to explore mathematical, physiological, and dermatological progression curves on human faces in real-time. By implementing modern client-side machine learning technologies, this application processes high-density biometric landmarks directly on your device, eliminating data transmission latencies and ensuring absolute cryptographic and clinical privacy.
Human facial aging is a highly structured, non-linear physical system governed by tissue degradation, skeletal remodeling, fat pad migration, and mechanical crease progression. This simulation abstracts these morphological changes into computational transformations. The system deploys a high-fidelity spatial mesh to anchor age-regression and progression filters dynamically, adjusting to variable depth, rotation, and illumination.
To model biological progression, we approximate dermal changes mathematically. For age-regression ("Younger Mode"), the system targets neotenous facial traits characterized by soft tissue expansion, ocular optimization, and skin texture smoothing through bilateral spatial filtration. For age-progression ("Older Mode"), the system implements localized high-pass spatial noise mapping and mathematical wrinkles calculated along dynamic biomechanical stress vectors.
Technical Details
The underlying engine utilizes Google's MediaPipe Face Mesh module running in WebAssembly, mapping a three-dimensional mesh model consisting of $478$ vertices. Real-time canvas processing involves precise high-DPI scaling calibrations. The rendering canvas matches the physical client viewport dimensions multiplied by the hardware's device pixel ratio ($\text{DPR}$), ensuring sharp anti-aliased signal lines without inducing layout loops:
$$\text{Internal Canvas Dimension} = \text{Client Bounding Rect} \times \text{Device Pixel Ratio}$$
To simulate physical modifications, we deploy specific linear coordinate manipulations and blend equations:
1. Spatial Neoteny Transformations (Eye Enlargement):
Within the left eye region $\mathbf{E}_L$ and right eye region $\mathbf{E}_R$, we calculate the local centroid $\mathbf{c} = (c_x, c_y)$. For any rendering point $\mathbf{p} = (x, y)$ within the bounding eye sphere of radius $R$, the displacement field is scaled according to:
$$\mathbf{p}' = \mathbf{c} + (\mathbf{p} - \mathbf{c}) \cdot \left(\frac{\|\mathbf{p} - \mathbf{c}\|}{R}\right)^{\beta - 1}$$
where $\beta \in [1.0, 1.25]$ represents the intensity scaling factor. This creates a smooth, radial fisheye expansion concentrated entirely on the ocular structure without breaking external facial borders.
To prevent the coordinate mapping bugs common in generic implementations (such as the "goggles" artifact shown in testing), we utilize an offscreen secondary frame buffer. This technique copies identical coordinate selections from the processed rendering pipeline back to the output context, ensuring seamless color and lighting alignment across scale boundaries.
2. Wrinkle Generation via Spatial Embossing:
Rather than drawing static 2D lines, wrinkles are generated dynamically along anatomical landmarks representing the frontalis muscle (forehead lines), orbicularis oculi (crow's feet), and levator labii superioris (nasolabial creases). The shader simulates depth by projecting light-shadow coordinate offsets. A shadow line is rendered at a vector displacement of $\mathbf{d} = (0, \delta)$, followed immediately by a highlight line at $-\mathbf{d}$ using a screen blending mode:
$$I_{\text{composite}}(x, y) = I_{\text{base}}(x, y) \cdot (1 - \alpha \cdot T(x, y)) + \alpha \cdot H(x, y)$$
Where $T(x,y)$ represents the dark shadow-depth texture, $H(x,y)$ represents the highlight texture, and $\alpha$ is the progression intensity parameter.
3. Procedural Epidermal Pigmentation (Age Spots):
Dermatological sunspots and hyperpigmentation are simulated using localized Perlin noise matrices anchored to the dynamic coordinate space. An affine transformation matrix $\mathbf{M}$ is built from three facial anchor points: Nose Bridge ($\mathbf{P}_{168}$), Left Eye Corner ($\mathbf{P}_{33}$), and Right Eye Corner ($\mathbf{P}_{263}$):
$$\mathbf{M} = \begin{bmatrix} s \cos\theta & -s \sin\theta & t_x \\ s \sin\theta & s \cos\theta & t_y \\ 0 & 0 & 1 \end{bmatrix}$$
This affine matrix transforms the procedural noise pattern continuously, ensuring the age spots scale and rotate congruently with physical head movements.
4. Web Audio Synthesizer Integration:
To deepen physical feedback, a real-time FM synthesizer is integrated. Frequency modulation models the cellular degradation speed. When "Younger" mode is active, the oscillator scales to a pure, high-pitch harmonic tone ($350\text{Hz}$ carrier, $1.5\times$ modulation index). In "Older" mode, the synthesizer drops to a low-frequency, deep biophotonic resonance hum ($82\text{Hz}$ carrier, modulated by a sub-harmonic LFO), indicating cellular decay kinetics.
Future Directions
Engine modifications on the roadmap aim to introduce localized spectral classification models. By utilizing deep-learning classification tensors natively through TensorFlow.js WebGL backends, future updates will automatically determine localized pore density, skin tone variations, and UV sun damage metrics directly from your raw camera frames.
Further mechanical updates will introduce volumetric skeletal remodeling calculations. Since facial aging involves bone resorption (specifically around the mandible and eye sockets), we plan to warp the foundational 3D Mesh vertices using localized biomechanical vectors. This will allow the simulation to dynamically collapse jaw structures and deepen eye orbit cavities under high older-age intensity parameters.