Skip to content

About

🦀 🖥️ Render camera frames directly from the tauri backend with wgpu

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Tauri v2 + wgpu + nokhwa

Screenshot 2025-12-30 at 21 26 54

Warning This project is currently only compatible with macOS. Windows and Linux support is not implemented.

A demonstration of efficient camera frame rendering using Tauri v2 combined with wgpu and nokwha. This project renders camera frames directly to native windows using GPU textures, avoiding the overhead of Tauri's IPC or WebSocket approaches. Ideal for applications that require processing of the camera frames in the Tauri backend before rendering.

Rendering Modes

This is a fork of clearlysid/tauri-wgpu-cam and adds an example of toggling between two camera display modes:

  • Thumbnail Mode: Camera renders in a small overlay window positioned over the main window (default)
  • Background Mode: Camera renders as the full background of the main window, with UI elements layered on top

Development

Prerequisites

  1. Install Tauri prerequisites
  2. Install dependencies:
    yarn install

Running

make dev

Known Limitations

  • macOS camera format reporting can be inconsistent with nokhwa (yuyv instead of requested rgba), and the decoding (yuyv_to_rgba) is currently CPU-based, which may be a performance bottleneck (see benchmark). If you do not need to do further processing on the frame, the smartest thing to do would be to add a compute shader for the conversion in the GPU command buffer, before the rendering. This would reduce CPU->GPU bandwidth (yuyv is smaller than rgba) and speed up the conversion significantly. The conversion is a textbook GPU task.
  • We might lose the camera aspect ratio when resizing the window. Should be an easy fix
  • Will probably not work on Windows and Linux. Most window operations are done with macOS-specific APIs

Changes from Original

This fork includes the following updates:

  • Updated dependencies, notably wgpu to v28 (includes breaking API changes)
  • Added flume for async channels between camera and render loops
  • Added tracing/tracing-subscriber for structured logging
  • Implemented thumbnail/background mode toggle with surface switching
  • Added window management utilities for overlay positioning and transparency

Acknowledgments

This project is a fork of clearlysid/tauri-wgpu-cam.

Resources & Inspiration

About

🦀 🖥️ Render camera frames directly from the tauri backend with wgpu

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages