Face Light is a browser-native face enhancement app that takes a live webcam feed, runs face landmark detection with MediaPipe, and composites a corrected output stream in real time using a GPU-oriented rendering pipeline.
The project is designed as both:
- a working user-facing demo for webcam lighting and portrait enhancement
- a diagnostics-heavy prototype for tuning a face-processing pipeline in production-like browser conditions
It runs entirely on the client, which means there is no server-side image processing step. Camera access, face tracking, rendering, snapshots, and recordings all happen in the browser.
- Real-time split preview showing original and processed output side by side
- Lighting and portrait controls for brightness balancing, smoothing, warmth, saturation, sharpening, background blur, vignette, and grain
- Preset system with
Natural,Video Call,Portrait,Cinematic, andStudio - MediaPipe Face Landmarker integration for live face tracking
- WebGL2 compositor with multi-pass processing, timing support, and adaptive quality hooks
- Diagnostics export with structured log entries for app, camera, UI, and pipeline events
- Performance HUD and pass visualizer for GPU timing inspection
- Snapshot capture and short recording export from the processed stream
- Capability probing for browser features and WebGL2 hardware limits
- Vercel-ready static deployment with cross-origin isolation headers
At runtime, Face Light:
- Requests webcam access.
- Detects browser and GPU capabilities.
- Starts a face landmark worker using MediaPipe.
- Samples face regions such as the forehead, cheeks, and chin.
- Runs a compositor that balances luminance and applies enhancement passes.
- Displays a live before/after split preview.
- Exposes diagnostics, performance panels, and capture tools for inspection.
This makes it useful both as a product demo and as a development harness for experimenting with browser-native beauty and lighting correction.
The current app shell includes:
Resolution selectorwith480p,720p, and1080pCapability badgeshowing detected GPU backend informationSplit previewfor original versus corrected outputCapture toolbarfor snapshots and recordingsPreset barfor one-click looksCorrection controlsfor manual tuningFace mesh overlaytoggle for debugging landmark placementLuminance waveformfor region brightness feedbackPipeline visualizerfor pass timingsDiagnostics panelfor structured event loggingPerformance HUDfor runtime metrics
Available correction sliders:
Brightness BalanceSkin SmoothingWarm / CoolSaturationSharpeningBackground BlurVignetteFilm Grain
The app also exposes:
- a master
Correctionstoggle - a
Show Meshtoggle - automatic startup using the
Video Callpreset for a more visible default result
Built-in looks:
Natural: light-touch correctionVideo Call: brighter, smoother, more flattering conferencing lookPortrait: stronger blur and richer stylingCinematic: cooler tone, heavier vignette, visible grainStudio: stronger brightness equalization and sharper output
Vue 3 + Vitefront-end app shellMediaPipe Face Landmarkerworker for face detection and trackingWebGL2 compositor workerfor post-processing and final compositionCapture pipelinefor snapshots and recordingsDiagnostics + performance toolsfor debugging, export, and tuning
The compositor is structured as a multi-pass GPU pipeline. In broad terms:
- Camera frames are read from the input video track.
- Face landmarks are produced in a dedicated worker.
- Face-region masks are generated for skin and depth-like guidance.
- Correction passes run for brightness balancing and skin smoothing.
- Optional passes run for bokeh-style blur, sharpening, vignette, and grain.
- A final composite pass produces the processed stream shown in the UI.
- WebGL2 capability tiers with startup policy recommendations
- Runtime quality configuration and adaptive-degradation hooks
- Render target validation and framebuffer completeness checks
- Landmark texture-atlas upload path to reduce per-frame uniform traffic
- Context-loss handling and compositor rebuild logic
- GPU pass timing support for diagnostics and tuning
Vue 3ViteTypeScriptPrimeVueTailwind CSSMediaPipe Tasks VisionWebGL2WebCodecsOffscreenCanvasVercel
src/
components/ UI panels, controls, overlays, diagnostics
composables/ camera, capture, diagnostics, and pipeline hooks
pipeline/
compositor/ WebGL2 compositor and shader passes
frame-capture/ output stream capture utilities
landmark-buffer/ landmark interpolation and buffering
workers/ compositor and facemesh workers
utils/ feature detection and supporting utilities
public/
models/ MediaPipe face model assets
wasm/ MediaPipe wasm runtime assets
scripts/
download-assets.sh build-time asset fetcher
Node.js 20+recommended- a modern Chromium-based browser
- webcam access
- HTTPS in production, or
localhostfor local camera development
npm installThe postinstall step downloads the MediaPipe model and WASM assets automatically.
npm run devOpen the local URL printed by Vite, grant camera access, and the app should auto-start.
npm run buildnpm run previewThis repo is already configured for Vercel in vercel.json.
- build command:
npm run build - output directory:
dist - cross-origin headers are set so the app can run with
crossOriginIsolated
You can deploy directly with the button at the top of this README, or import the repo into Vercel manually.
Builds currently fetch MediaPipe assets during install/build using scripts/download-assets.sh.
That works on Vercel, but it does mean builds depend on external network availability:
- Google Cloud Storage for
face_landmarker.task - jsDelivr for the MediaPipe WASM files
If you want fully deterministic builds, vendor those assets into the repo or move them to a storage location you control.
The app targets modern browsers with:
WebGL2OffscreenCanvasrequestVideoFrameCallbackorMediaStreamTrackProcessorSharedArrayBuffersupport in cross-origin isolated environmentsWebCodecsfor the best capture/runtime path
The app probes feature availability and GPU limits at startup and uses a capability tier to choose safer defaults.
Face Light includes a diagnostics log that captures structured events from:
- the app shell
- camera startup
- worker initialization
- pipeline lifecycle
- UI interactions
- runtime errors
This is useful when debugging:
- browser capability mismatches
- camera startup failures
- worker messaging issues
- context loss
- performance regressions
The diagnostics panel can export a session log for reproduction and issue reporting.
This app is intentionally GPU-heavy.
Behavior depends on:
- browser support level
- webcam capture resolution
- GPU driver quality
- laptop thermals and power mode
- whether expensive effects like blur are enabled
The repo already contains:
- pass timing instrumentation
- adaptive quality plumbing
- capability-tier startup defaults
- reduced-resolution paths for more expensive blur work
Even with those safeguards, browser graphics stacks are inconsistent, so cross-device testing still matters.
- camera access only works on secure origins or
localhost - build-time asset fetching makes production builds network-dependent
- the runtime path is centered on
WebGL2;WebGPUcode exists but is not the active backend - effect quality and stability vary across browsers and drivers
- this is still closer to an advanced demo/prototype than a hardened consumer product
Check whether the asset download step failed. The build needs outbound access to download MediaPipe assets.
The app starts with the Video Call preset, which is visible but still moderate. Try switching to Portrait or Cinematic and increasing blur, sharpening, or vignette.
Check the diagnostics panel first. The most common causes are:
- unsupported browser capabilities
- worker initialization errors
- camera permission issues
- graphics driver or WebGL-related failures
The camera hardware may negotiate down from the requested ideal dimensions. That is normal and depends on the device/browser combination.
Face Light is a useful starting point for teams exploring:
- browser-native webcam enhancement
- real-time face-region correction
- WebGL2 post-processing pipelines
- MediaPipe integration in a worker-based architecture
- diagnostics-first prototyping for graphics-heavy web apps
Issues and PRs are welcome if they are concrete and technically grounded.
Good contribution areas:
- browser compatibility hardening
- WebGPU backend completion
- shader quality improvements
- automated tests and CI
- UX polish around capture and diagnostics
- selectable WebGPU backend
- stronger fallback modes for lower-end devices
- reusable benchmark scenes
- better automated browser coverage
- model/version pinning for deterministic production builds
- shareable preset URLs and session profiles
Local production builds currently pass with:
npm run buildThe repo is also configured to deploy as a static app on Vercel.
Built by @pradhankukiran.