Skip to content

The native runtime for three.js: three.js, down to the metal. 45× smaller than Electron, on a Sony PS3, and path-traced at 60 fps on ray-tracing GPUs.

2.9 KB
Raw Blame

ThreeRT Live 3D Wallpaper Host for Omarchy (threert-wallpaper)

A single-process, low-power Wayland wlr-layer-shell (Layer::Background) host that runs standard three.js WebGPURenderer + TSL scenes natively on threert-jsc + threert-webgpu (wgpu over Vulkan) — with zero Chromium/WebView/DOM overhead and native Omarchy integration.

See REPORT.md for the full design overview and apples-to-apples ThreeRT vs Chromium 155 WebGPU benchmark on Omarchy Orbital — Living Earth.

Features

  • Native Wayland wlr-layer-shell (Layer::Background) + wp_viewporter: Direct zero-blit swapchain rendering with fractional HiDPI (1.5×, 1.25×, etc.) and dynamic render scaling.
  • Omarchy Shell Seamless Handoff (--omarchy): Suspends omarchy-shell's static background after the first frame is presented (omarchy-shell -q background setSuspended true) and cleanly restores it on SIGINT/SIGTERM/exit.
  • Zero-Overhead Hyprland Occlusion Auto-Pause: Event-driven listener on $XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock; halts JS rAF + GPU submission completely (0.00% CPU, 2.1 wakeups/s, 97% iGPU RC6 sleep) whenever windows cover the desktop or DPMS turns off.
  • AC / Battery Power Profiles: Initializes wgpu with PowerPreference::LowPower and MemoryHints::MemoryUsage; adapts FPS and render scale automatically on battery (--fps 60 --battery-fps 24 --render-scale 1.0 --battery-scale 0.75).
  • Live Omarchy Theme Sync: Watches ~/.local/state/omarchy/current/theme/colors.toml and pushes palette updates into globalThis.__wallpaper.onThemeChange(...).
  • Zero-Copy Local Resource Loader: Exposes __native.sys.resource(path) backed by --assets <dir> (default <script_dir>/assets) so high-res textures decode offline via createImageBitmap.

Build & Run

# 1. Build the release binary (~7.4 MiB stripped)
cargo build --release --manifest-path webgpu/wallpaper/Cargo.toml

# 2. Bundle the 4K Earth demo ("Omarchy Orbital — Living Earth") + stage textures (see Assets below)
bun webgpu/wallpaper/demo/build.mjs

# 3. Run live as your Omarchy desktop wallpaper (Ctrl-C cleanly restores static wallpaper)
./webgpu/wallpaper/target/release/threert-wallpaper \
  --runtime out/webgpu/runtime.js \
  --script out/webgpu/wallpaper-demo.js \
  --omarchy --fps 60 --battery-fps 24

# 4. Run the apples-to-apples ThreeRT vs Chromium WebGPU benchmark
node webgpu/wallpaper/bench/bench.mjs --duration 12

Assets

The demo's three 4K textures (earth_day_4096.jpg, earth_night_4096.jpg, earth_bump_roughness_clouds_4096.jpg, made from NASA imagery) are not committed. They are in doodlewind/ThreeRT-dev#8 (demo/assets/); put them in webgpu/wallpaper/demo/assets/ (ignored by git) before step 2.