RENDERMAN 22 DOCUMENTATION

Page tree

Versions Compared

Key

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

Before After Image Slider (Deprecated)
methodoverlay
leftImage2497545
rightImage2497544

Monte Carlo algorithms have diminishing returns on the number of samples. To cut the amount of noise in a rendered image in half, it can commonly take four times the number of samples. RenderMan ships with a new tool that offers an alternative approach to reducing noise in rendered images. This tool was originally created by Walt Disney Animation Studios and Disney Research for Big Hero 6 and as a result has already been tested and proven in feature film production.

...

We need to set up a few nodes for running the denoise utility as a post process.

  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.

    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 the script 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.

...

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 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,diffuse,diffuse_mse,specular,specular_mse,z,z_var,normal,normal_var,forward,backward" "int asrgba" 1
Hider "raytrace" "string pixelfiltermode" "importance" # ...

 

The denoise utility expects a multichannel OpenEXR with the exact channel names given here. 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.

...

The setup is very similar to single frame filtering except we use --crossframe -v variance with previous frame, current frame, and next frame in the renderSettings' scriptCommand:

 

Code Block
`$RMANTREE/bin/denoise  --crossframe -v variance
image.'+str(int(frame)-1)+'.exr image.'+str(int(frame))+'.exr image.'+str(int(frame)+1)+".exr"

...

If you are using a render farm and would like to distribute the denoising work across the nodes, or you'd like to interleave rendering and denoising you can also do this, though the approach is slightly more complex: 

Code Block
prman frame01.rib
prman frame02.rib
prman frame03.rib
denoise --crossframe -v variance -L frame01.exr frame02.exr frame03.exr
prman frame04.rib
denoise --crossframe -v variance -F -L frame02.exr frame03.exr frame04.exr
prman frame05.rib
denoise --crossframe -v variance -F -L frame03.exr frame04.exr frame05.exr
...
prman frame98.rib
denoise --crossframe -v variance -F -L frame96.exr frame97.exr frame98.exr
prman frame99.rib
denoise --crossframe -v variance -F frame97.exr frame98.exr frame99.exr

...

In some cases, you may wish to denoise individual passes, 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 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 must have color channels named one of:

    • diffuse
    • specular
    • directdiffuse
    • directspecular
    • indirectdiffuse
    • indirectspecular

    These may be optionally suffixed with a number from 0 through 499 to distinguish the different passes for a frame. Combined diffuse and specular components can also be placed in matching channels named emission (e.g., directdiffuse17 plus directspecular17 in directemission17), in which case the denoiser will also produce the filtered summation.

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.

For instance, in the example below, the number of files for diffuse_key and specular_key and their order are the same. The denoise sees two sets: diffuse and specular. 

Code Block
$RMANTREE/bin/denoise --crossframe --override filterLayersIndependently true --
image_variance.{5,6,7}.exr diffuse_key.{5,6,7}.exr specular_key.{5,6,7}.exr

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, e.g.:

From RIB

Single Frame

 

Code Block
denoise --override filterLayersIndependently true -- master_variance.exr light0_dir.exr light1_indi.exr

...

 

Code Block
denoise --crossframe --override filterLayersIndependently true --
        master_variance.1.exr master_variance.2.exr master_variance.3.exr
        light0_dir.1.exr light0_dir.2.exr light1_indi.1.exr light1_indi.2.exr

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":

Single Frame

...

Code Block
$RMANTREE/bin/denoise --override filterLayersIndependently true -- $INPUT diffuse_key.#.exr

Cross Frame

...

Code Block
'$RMANTREE/bin/denoise  --crossframe --override filterLayersIndependently true --'
    +' 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'

Single Frame

Code Block
denoise --override filterLayersIndependently true -- master_variance.exr light0_dir.exr light1_indi.exr

Cross Frame

Code Block
denoise --crossframe --override filterLayersIndependently true --
        master_variance.1.exr master_variance.2.exr master_variance.3.exr
        light0_dir.1.exr light0_dir.2.exr light1_indi.1.exr light1_indi.2.exr