Skip to content

NSI/RenderMan® OpenEXR display driver with support for OIDN denoising; written in Rust.

License

Notifications You must be signed in to change notification settings

virtualritz/r-display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

r-display

NSI/RenderMan® OpenEXR display driver with Open Image Denoise support written in Rust.

Build instructions should work for Linux and macOS. On Windows your mileage my vary.

Building

You need a copy of Intel® Open Image Denoise (OIDN). Grab a package from their download section. Unpack this somewhere. We refer to this below as the OIDN location.

Linux

Export the OIDN location for the build to find the headers & libraries. For example:

export OIDN_DIR=$HOME/Downloads/oidn-1.3.0.x86_64.linux/

Build the display driver:

./build-linux.sh

macOS

Export the OIDN location for the build to find the headers & libraries. For example:

export OIDN_DIR=$HOME/Downloads/oidn-1.3.0.x86_64.macos/

Build the display driver:

./build-macos.sh

Windows

Brief

We assume you are using PowerShell. You need to have LLVM installed somewhere. Export the OIDN location for the build to find the headers & libraries. For example (using PowerShell):

set OIDN_DIR='C:\Downloads\oidn-1.3.0.x64.vc14.windows\oidn-1.3.0.x64.vc14.windows'

Set the he LLVM installation directory. For example:

$Env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin\"

Build the display driver:

cargo build --release

Detailed (For Non-Technical Peeps)

You need to have PowerShell 2 or later installed. To install it click the lower left corner Windows icon and start typing PowerShell. Install Chocolatey. It is a package manager that will make installing the rest of the stuff you need painless.

Open PowerShell and follow the instructions.

  1. Install git:
    choco install git
  2. Install Visual C++ Build Tools:
    choco install visualcpp-build-tools
  3. Install Rust:
    choco install rust-ms
  4. Install LLVM:
    choco install llvm
  5. Set the LLVM location:
    $Env:LIBCLANG_PATH = "C:\ProgramData\Chocolatey\bin"
  6. Set the OIDN location you choose above. For example:
    $Env:OIDN_DIR = "C:\Downloads\oidn-1.3.0.x64.vc14.windows\oidn-1.3.0.x64.vc14.windows"
  7. Create some folder to host the repository during build and change to there. Note that you can delete this later.
    md -Path "C:\MyProjects"
    cd "C:\MyProjects"
  8. Clone the r-display repository and hop into it:
    git clone https://github.com/virtualritz/r-display
    cd r-display
  9. Build the display driver:
    cargo build --release
  10. Copy the result to the 3Delight display folder:
    cp target\release\r-display.dll $Env:DELIGHT\displays

How To

There is an example app in examples/denoise.rs. This shows how to add the two optional auxiliary AOVs for albedo & normal when instancing the display driver through the NSI crate.

For this to work you need to download & install a 3Delight package for your platform.

To run the example:

cargo run --example denoise

This will launch the render and dump the raw data of a render with one sample per pixel to 3Delight Display. It will save a denoised version to test_0001samples.exr.

Parameters

Denoising

Comparispon of denoising results|ɴsɪ

The display driver uses Intel® Open Image Denoise to denoise the 1st set of RGB channels. This is switched on by default.

Use the denoise (float) parameter to control this.

Setting this to zero switches denoising off.

Setting this to a value above 0 and below 1 linearly blends the denoised image with the original.

Setting it to one (or above) switches denosing on. This means the original pixels will be discarded and replaced with denoised ones.

If you want support for keeping the original image in a separate layer of the EXR open an issue and I see what can be done.

You can use albedo and normal (requires the former) layers to improve the denoising.

Compression

This display driver supports the following OpenEXR compression methods which are set by the compression (string) parameter:

  • none uncompressed
  • zip (lossless)
  • rle (lossless)
  • piz (lossless)
  • pxr24 (lossy)
  • b44, b44a not yet supported (could be added since there is support in the exr crate for this now)
  • dwaa, dwab not yet supported

Other

When premultiply (integer) is set to zero the image will be written out unpremultiplied.

A line_order parameter can be used to set this explicitly to e.g. store the image bottom-top. Accepted values are increasing and decreasing. If unspecified the driver will choose a line order matching the compression.

A tile_size (integer[2]) parameter can be specified to set the width and height of the tiles the image is stored in. If unspecified the driver will choose a tile size matching the compression.

Caveats

The display driver needs work if one wanted to use it for multi-layer EXRs (e.g. writing a single EXR that contains a bunch of AOVs as layers).

What would be needed was a way to designate which input layers should be denoised and maybe also a way to filter out utility passes only added for the denoiser so they don’t take up disk space.

If you want to use this in production and need those features ping me.

Metadata

The display driver exports some metadata that is common to EXR files:

  • pixel aspect
  • world to camera
  • world to normalized device
  • near clip plane
  • far clip plane
  • software name

About

NSI/RenderMan® OpenEXR display driver with support for OIDN denoising; written in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published