RENDERMAN 22 DOCUMENTATION

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Before After Image Slider
methodoverlay
width350px
overlayedSlidertrue
leftImageimage_galleries_uuid_
denoiseBefore
denoisebefore.png-
38210806
3c662825-
8fe1
87f2-
4a0b
4bcd-
b562
b5b8-
63059edfeb15
7729d11f29b8
rightImageimage_galleries_uuid_denoiseafter.png-
2736dd55
dc427c2e-
47d6
c73a-
4175
4fd6-
bd1d
9475-
734f72afb944
458ef74e7eb8

96 samples per pixel, before and after denoising

...

  1. Prman Globals Settings

    Turn on importance sampling for the raytrace hider's pixel filter mode. This will eliminate splotchiness in the render.
     

     

  2. PrmanDenoiseChannelDefine

    Create a PrmanDenoiseChannelDefine node which is a macro for creating all the specific DisplayChannels required for the denoise utility.
     

  3. PrmanDenoiseRenderOutputDefine

    Create a PrmanDenoiseRenderOutputDefine node which is a macro for rendering a multichannel OpenEXR file for the beauty pass combined with the AOVs.

    Note

    Be sure the Type is set to raw

     

    Info
    If your pipeline does not support multichannel EXR, you can use $RMANTREE/bin/exrmerge to combine the AOVs into a multichannel EXR. Then use this merged multichannel EXR for the denoise utility. Note that each AOV's type should be set to "raw" because this preserves the channel name in the EXR which the denoise utility will look for. Combined EXR using Katana's RenderOutputDefine's merge will not work with the denoise utility.
  4. Running Denoise Via RenderOutputDefine Script (Single Frame)

    Create a RenderOutDefine. Wire this node to the previous RenderOutputDefine node. Select script for the type, select primary for the scriptInput, and set the scriptCommand to the following:

    Code Block
    $RMANTREE/bin/denoise $INPUT

    By default, it will write out <image>_filtered.exr. This can be changed by specifying -o. Run denoise -help for more information on other denoise utility options.

Users must run a disk render in order to denoise an image. Denoising is not currently supported in interactive rendering.  Note that we can also run the denoise utility for AOVs; see Layered Filtering below for more information.

...

Required Channels

Setting up a scene in RIB for denoising is more involved if you are doing it manually, but most of the work is in adding the correct DisplayChannel lines to the prologue. Here is the basic snippet that you will need:

Code Block
# Beauty...
DisplayChannel "color Ci"
DisplayChannel "float a"
DisplayChannel "color mse" "string source" "color Ci" "string statistics" "mse"

# Shading...
DisplayChannel "color albedo" "string source" "color lpe:nothruput;noinfinitecheck;noclamp;unoccluded;overwrite;C(U2L)|O"
DisplayChannel "color albedo_var" "string source" "color lpe:nothruput;noinfinitecheck;noclamp;unoccluded;overwrite;C<.S'passthru'>*(C(U2L)|O)" "string statistics" "variance"
DisplayChannel "color diffuse" "string source" "color lpe:C(D[DS]*[LO])|O"
DisplayChannel "color diffuse_mse" "string source" "color lpe:C(D[DS]*[LO])|O" "string statistics" "mse"
DisplayChannel "color specular" "string source" "color lpe:CS[DS]*[LO]"
DisplayChannel "color specular_mse" "string source" "color lpe:CS[DS]*[LO]" "string statistics" "mse"

# Geometry...
DisplayChannel "float z" "string source" "float z" "string filter" "gaussian"
DisplayChannel "float z_var" "string source" "float z" "string filter" "gaussian" "string statistics" "variance"
DisplayChannel "normal normal" "string source" "normal Nn"
DisplayChannel "normal normal_var" "string source" "normal Nn" "string statistics" "variance"
DisplayChannel "vector forward" "string source" "vector motionFore"
DisplayChannel "vector backward" "string source" "vector motionBack"

Display "image.exr" "openexr" "Ci,a,mse,albedo,albedo_var,diffuse,diffuse_mse,specular,specular_mse,z,z_var,normal,normal_var,forward,backward" "int asrgba" 1
Hider "raytrace" "string pixelfiltermode" "importance" # ...

...

Note

We mention use of "normal Nn", however for hair we recommend substituting Tn "Hair Tangent" for the best results of Denoising hair.

 

In the above example we include "vector forward" and "vector backward" for completeness. These are only used (one or the other or both) for cross-frame denoising but not for a single frame. If only one exists, the Denoiser assumes the opposite vector for the missing direction. If neither exists, it will still operate but in a limited capacity.

The denoise utility expects a multichannel OpenEXR with the exact channel names given here. Channel names may be [Ci.r Ci.g Ci.b Ci.a] or [R G B A] as specified in the EXR. Light Path Expressions are used to separate the diffuse and specular components and to retrieve the unlit albedo colors for the materials. The statistics parameters are used to request that prman produce images that estimate the variance or the error in the linked image. The forward and backward channels are not strictly necessary here, but become useful when filtering image sequences with motion blur.

...

By default, it will write out <image>_filtered.#.exr. This can be changed by specifying -o. See denoise -help for more information on other denoise command options.  Note that we can also run the denoise utility for AOVs with crossframe; see Layered Filtering below.

From RIB

If rendering straight from RIB, configure each frame the same as you would for basic rendering as above. For best results you will want to make sure that the motion vectors, forward and backward, are included this time. Then run the denoise utility with:

...

The -F and -L options ask the denoiser to use the first and last of the given images, respectively, when doing cross-frame filtering but not to actually denoise those images themselves. Thus using -F and -L with frames 2, 3, and 4 will filter and write frame 3 only, though it will use frames 2 and 4 to do so. The first and last executions of denoise here are the exceptions in that they are set to filter two frames at a time. In any event, when run this way the denoiser will always be working one frame behind the rendering.

Layered Filtering

...

For AOVs

...

In some cases, you may wish to denoise individual passes/AOVs, such as the diffuse contribution for a particular light group. Rather than duplicate the geometry channels into the images for each pass, it is possible to write them out once per frame and then combine them with the individual pass images. In order for this to work some fairly strict naming requirements must be met:

...

. The below names are required so that the denoise tool knows what the channel contains, it does not determine the contents by looking at them. This is why the naming convention must be followed:

  • The master image that contains all of the common channels (configured as above for the basic denoising) must have a file name that ends in either _variance.exr or .variance.exr.
  • The pass images can be named anything else, but by default must have color channels named/prefixed as one of:

    • diffuse
    • specular
    • directdiffuse
    • directspecular
    • directDiffuse
    • directSpecular
    • indirectdiffuse
    • indirectspecular
    • indirectDiffuse
    • indirectSpecular

    These may be optionally suffixed with a matching suffix to distinguish the different passes for a frame (e.g., directdiffuse_11235_a_moose_once_bit_my_sister). Combined diffuse and specular components can also be placed in matching channels named emission (e.g., directdiffuse_foo17 plus directspecular_foo17 in directemission_foo17), in which case the denoiser will also produce the filtered summation.  If the default prefixes in the list above do not suit you, you can edit them in the layergroups section of the installed default.filter.json file for your pipeline naming. Make a backup of this file first.

Note that the number of files and their order must match. The denoise utility divides the non variance images by the number of variance images to determine how many sets there are.

...

Once this is done, the images can be given to the denoiser. For best results, you will probably want to use an additional option to filter the layer independently.

Filter Layers Independently

For performance reasons, filter layers independently is "false" in the .json files. This is because the denoiser computes a single filter kernel from the *_variance.exr file and then applies this to all the AOVs. This saves memory and time but may not be quite as aggressive as you need. If you set this to "true" then it will compute a filter kernel for  each  AOV independently and apply it. This takes more time and memory. It may also mean that it violates your additive compositing between layers and you may have a (usually) slight image change. But since it's more tuned to each AOV layer, it may give you better results.

Example: Your diffuse is converged but your specular is quite noisy, filtering the specular independently may give you better results for the specular channel than if you used the filter kernel computed based on all the channels.

Using Katana

In Rfk, the setup is similar to the process for the beauty pass in addition to appending the AOVs in the renderSettings' scriptCommand. In this example, diffuse_key.#.exr is the diffuse AOV for the light group "key":

...

Code Block
'$RMANTREE/bin/denoise  --crossframe '
    +' image_variance.'+str(int(frame)-1)+'.exr'
    +' image_variance.'+str(int(frame))+'.exr'
    +' image_variance.'+str(int(frame)+1)+'.exr'
    +' diffuse_key.'+str(int(frame)-1)+'.exr'
    +' diffuse_key.'+str(int(frame))+'.exr'
    +' diffuse_key.'+str(int(frame)+1)+'.exr'

From RIB

Single Frame

Code Block
denoise master_variance.exr light0_dir.exr light1_indi.exr

...