Skip to content

About

Open Image Denoise on WebGPU

Topics

Resources

Stars

299 stars

Watchers

4 watching

Forks

Repository files navigation

oidn-webgpu

Open Image Denoise (OIDN) on WebGPU. It denoises path-traced images on the GPU, in browsers and natively through wgpu.

Formerly published as oidn-web; versions up to 0.5.0 remain available under that name.

Classroom 2 at 8 samples: noisy input on the left, OIDN denoised output on the right

Classroom 2 in MuTracer, rendered at 1280 × 720.

Runtimes

Runtime Status Distribution Guide
Browser (WebGPU) Released (0.x) npm oidn-webgpu docs/web.md
C/C++, sharing the host's Metal, Vulkan or DX12 buffers Experimental GitHub Releases or build from source native/README.md
Rust, sharing the host's wgpu device and buffers Experimental crates.io or Cargo Git dependency native/README.md
C, CPU images in and out Experimental GitHub Releases or build from source native/README.md

Every runtime executes the same WGSL kernels, planned by the same TypeScript core. The native guide records tested GPU configurations and output validation.

Quick start (browser)

npm i oidn-webgpu

Weights are not in the package. Copy a .tza file from weights/ or oidn-weights and serve it with your app.

import { initUNetFromURL } from 'oidn-webgpu';

const unet = await initUNetFromURL('/weights/rt_ldr.tza');
const noisy = ctx.getImageData(0, 0, width, height);

const abort = unet.tileExecute({
  color: noisy,
  progress(_image, tileData, tile) {
    ctx.putImageData(tileData!, tile.x, tile.y);
  },
  done(denoised) {
    ctx.putImageData(denoised, 0, 0);
  },
  error(reason) {
    console.error(reason);
  }
});

HDR input, auxiliary images, GPU buffers, tiling and performance options are in the browser guide.

Choose weights

Pick the weights from what your renderer produces. The same files work in every runtime.

File Color Auxiliary inputs Browser options
rt_ldr.tza LDR none {}
rt_ldr_alb_nrm.tza LDR albedo + normal { aux: true }
rt_hdr.tza HDR none { hdr: true }
rt_hdr_alb_nrm.tza HDR albedo + normal { hdr: true, aux: true }
rt_hdr_alb_nrm_small.tza HDR albedo + normal; faster, lower quality { hdr: true, aux: true }
rt_hdr_calb_cnrm.tza HDR noise-free albedo + normal { hdr: true, aux: true }
rt_hdr_calb_cnrm_large.tza HDR noise-free albedo + normal; slower, higher quality { hdr: true, aux: true }
rtlightmap_hdr.tza (oidn-weights) HDR lightmap none { hdr: true, hdrTransfer: 'log' }

The model size (small, default, large) is chosen by the file alone; no option changes. Loading throws if aux does not match the file's inputs. An HDR/LDR mismatch cannot be detected from the file, so set hdr to match the weights.

Documentation

Document Covers
docs/web.md Browser API: loading, inputs, tileExecute, GPU pipelines, tiling, precision, profiling
native/README.md GPU C/C++, CUDA, Rust and CPU C APIs, image contract, builds and precompiled packages
native/examples/gpu-integration.md GPU C API step by step in plain C, C++17 wrapper details, Windows CUDA adapter
docs/development.md Architecture, build/test/benchmark commands, updating OIDN models, CI
docs/native-release.md Maintainer guide for publishing native packages and the crate
AGENTS.md Repository map and working rules for coding agents and contributors
llms.txt Doc index for LLM tools
CHANGELOG.md Browser package release notes and migration steps
native/CHANGELOG.md Native library (Rust crate, C/C++ packages) release notes and migration steps

Examples and users

Credits and license

Inspired by Max Liani's series DNND: a deep neural network dive.

Code is MIT licensed (LICENSE). The OIDN weights in weights/ are Apache 2.0 (weights/LICENSE.txt).

About

Open Image Denoise on WebGPU

Topics

Resources

Stars

299 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages