OHAO · Implementation Monograph

Monograph · 09 · Denoising

09

Pipelines · full depth

Denoising

Chapter contract

Denoise is a staged backend after the integrator. This chapter maps offline vs realtime pipelines, resource traits, packing contracts, and compose — enough to debug magenta without guesswork.

Where denoise sits

traceRays AOV pack Denoise Compose Present FIG. DN-1 · AFTER INTEGRATOR
Fig. DN-1

Packing errors show up as “denoise bugs” but are often raygen contract bugs.

Mode selection & traits

ModeTypical useTrait needs
OIDNOffline stillsCPU readback; albedo+normal guides
NRDRealtime PTmotion, diff/spec split, Halton jitter
DLSS-RRRealtime + NGXmotion, extended guides, hit-dist (binding 35)
AtrousInternal spatialoptional motion
NoneDebug noise

RTProfileTraits: offline allows external denoise (OIDN default); realtime enables internal denoise flags / firefly clamp. CLI --denoise= overrides. Changing mode may require image/pipeline features already allocated at PT init.

OIDN full path

Offline still
  1. Accumulate N spp into HDR beauty (binding 1) + albedo/normal AOVs
  2. Readback to CPU (or GPU OIDN path depending on build)
  3. OIDN filter with guides
  4. Write denoised beauty; tonemap / PNG
Why OIDN offline

Best quality/stability for stills and turntables. Too heavy as a default interactive path — that is NRD/DLSS territory.

NRD full path

Realtime frame
  1. Raygen writes demod diffuse/specular radiance + hit-dist (packed), normal-rough, motion, ViewZ, demod albedo/F0
  2. Optional PT_FLAG_ACCUMULATE_AOVS running mean for multi-spp
  3. NRD REBLUR (or related) compute dispatches consume packed inputs
  4. Write denoised diff/spec (bindings 27–28 on set 0)
  5. nrd_compose: unpack YCoCg → linear, recombine, env miss fill as configured
  6. Cinematic / tonemap modules → presentable beauty

Packing math (the contract)

\[ Y=\tfrac14R+\tfrac12G+\tfrac14B,\; C_o=\tfrac12R-\tfrac12B,\; C_g=-\tfrac14R+\tfrac12G-\tfrac14B \]
\[ \widehat d=\mathrm{saturate}\!\left(\frac{d}{(A+|z|B)\,\mathrm{mix}(C,1,\alpha^{2})}\right) \]

nrdPackRadianceHitDistvec4(YCoCg, normHitDist). Normals via rotated-oct + roughness carrying \(n_z\) sign. Compose must call unpack. Magenta helmet: linear RGB written where YCoCg expected.

DLSS-RR path

When OHAO_DLSS + NGX ok
  1. Device must have advertised NVX/push-descriptor exts at createLogicalDevice
  2. PT flag DLSSRR may repack normalAOV as (N, roughness)
  3. Binding 35: specular hit-distance guide
  4. NGX eval; on failure fall back to raw / other denoise

Debug checklist

Before blaming the denoise library

1) Inspect pre-denoise AOVs (neutral?). 2) Confirm mode traits (motion present?). 3) Confirm pack/unpack pair. 4) Confirm resolution matches. 5) Only then upgrade NRD/OIDN versions.

oidn_denoise.*OIDN
nrd_denoise.* / nrd_compose.* / nrd_cinematic.*Realtime chain
nrd_frontend.glslPack/unpack
dlss_rr.*NGX
rt_meta.hpp / denoise_types.*Traits · modes

Design units in this module

Each card is a focused design page (what / how / why + sources). Full tree: Sitemap.