# Scripted

# Installation

•If you have not changed your users houdini.env to add some plugins, then it is sufficient to install the Submission Plugins via rrWorkstationInstaller.

•Otherwise you have to edit your users houdini.env file.
In case you already have some modifications for HOUDINI_PATH, then add this line to the end of the file:
HOUDINI_PATH = $RR_ROOT\render_apps\_submitplugins\Houdini;$HOUDINI_PATH
In case there is no line that changes HOUDINI_PATH, then add this line to the file:
HOUDINI_PATH = $RR_ROOT\render_apps\_submitplugins\Houdini;&

# Submission

HtoRR offers different ways to submit jobs to Royal Render.

To submit a job to Royal Render you can

1. Menu Render -> Submit to Royal Render
If you have selected nodes, then these selected nodes and their incoming nodes will be parsed and submitted.
If no nodes are selected, all available ROP networks will be submitted

2. Right-click on a node and select "Submit to Royal Render".

3. Add a rrSubmitter node to your /our or /stage graph and connect it to the ROP/LOP
Note: As LOPs do not have output connections, you have to add the LOP path to the rrSubmitters parameter "Output Driver".

Hint:
To disable a node from being parsed, the user can set this node to bypass.
Incoming nodes will still be parsed, but without adding further functionality.

# Special node type support

RR supports special nodes as well:

•Merge

•Switch

•Wedge

•Fetch

# Unsupported nodes

The Submitter might not support all nodes.

In this case you can use a workaround:

Create a Fetch and a Mantra ROP in /out.

Fetch the unsupported node you want to process.
Connect Fetch into Mantra.

Set Mantra to some small resolution like 100x50.
Submit the Mantra node.

So far these nodes are supported in RR 9.1.23:

•Alembic

•Geometry

•Filecache

•Comp

•Copernicus

•USD

•USDrender

•USDstitch

•Arnold

•Mantra

•Octane

•OpenGL

•Redshift

•Renderman

•Karma

•VRay

# Ignore Nodes for submission

There are a two ways to tell the plugin not to submit a ROP/LOP:

1. The ROP itself or any of the parent nodes should be set to "bypass" in Houdini.

2. Add a spare parameter of type "Toggle" to the ROP/LOP and name it "rr_disabled".

# New Royal Render Nodes

The Houdini to Royal Render plugin comes also with additional node types:

•rrSubmitter

•rrDependency

•rrGenericJob

•rrPython

•rrDenoise

## rrSubmitter ROP/LOP

The RR Submitter node enables you to set basic Royal Render settings for jobs which eventually will be generated upstream.
It also comes with the functionality to send the submission generated by the incoming nodes directly to the farm without opening the Royal Render Submitter window.

The plugin is designed to handle large and complex ROP networks to facilitate different kinds of production needs.
It is therefore possible to use and combine multiple rrSubmitter nodes.
If you override a setting in a rrSubmitter node, then this override is applied to the parent input ROPs only.
Please see the end of this help page for examples.

### Spare parameter instead:

If you do not want to use the rrSubmitter ROP node,

then you can add spare parameter to your ROP/LOP for job overrides.

How to add spare parameter in Houdini:
https://www.sidefx.com/docs/houdini/network/spare.html#how-to

Supported spare parameter names are:

•rr_jobsettings

•rr_job_variables

•rr_env_variables
Please see next section for an explanation of "Job Settings", "Job Variables" and "Env Variables"

### UI layout

Main Settings

Archive Mode | If you submit a ROP that has activated an archive export (.usd / .ifd.sc / .ass.gz / .rs /.rib ), then you can choose which job RR should submit. Note that you can use multiple rrSubmitter nodes with different settings (see examples at the end of this help page)
Fetch Output Driver | Instead if using an input connection, you can specify the ROP/LOP to be parsed.
Automatically Save Hip Files | Save the hip file before submission.
Cook tree | Executes a cook on the scene. (e.g. in case you have set your Houdini tree to cook manually)
Pre Submit Python Cmd | A python expression(command) that will be executed before the rrSubmitter ROP adds its jobs to the submission. If the expression fails with a python exception or returns False, then this rrSubmitter ROP does not continue. Expression examples:
False | Returns False
hou.takes.currentTake().name()=="Main" | This boolean expression returns True or False.
MySceneCheck() | Executes this function. The function may return a value (True/False) or not.
self._node.parm("MySubmissionCount").set(self._node.evalParm("MySubmissionCount") + 1) | Increases a custom spare parameter in this ROP.
print("Hello!") | Not sure what this is doing, have to ask the developer of this plugin ;-)
Python Expression <> Statement? Note that it uses the python function eval( "MyPreExpression" ), which does not support any complex command, just one expression. If you do not know if your code is an expression, imagine doing this with your "MyPreExpression" in python: any_variable = ( MyPreExpression ) Example: any_variable = printf("Hello") Workaround Expression <> Statement There is a workaround by using exec(), but note that exec() cannot return any value. You have to raise an exception instead of returning False! Examples: •exec('import myLib ;myLib.exec()') •exec('a=5 \nb=10 \nif a==b: \n\traise Exception("WTF!!") ') Note that you can use ; or \n within python to create a new code line. You can either use a tab \t or 4 spaces for indentation. Hint: Spaces at the end of a line dont bother python, but helps you reading this string.

Job Settings
Most override have a checkbox to enable the override for that setting.
If you enable the override, it is set for all incoming nodes.

Scene Display Name | Change the scene name display in rrControl
RR Renderer Name | Overrride the renderer name that should be used for the rrJob. This way you can choose a different render config for your job. Only required if you have created custom render configs, e.g. if you have enabled RRs REZ support in these ones. Note that you can use it to add a prefix or suffix to the renderer name as well. Like *_rez
Assign To | Override clients or client groups to submit the job to.
Priority | Override rrJob setting "Priority".
Distribution Mode |
Full | The submitted job will be distributed in random order between all clients set at the "Assign to" option
Frame After Frame | The submitted job will be processed by only one client at a time in the correct frame order. The job is not necessarily completly processed by only one client. A client can pick up the work at the point where another client left off.
One Client | The complete job will be processed by one client in the correct frame order. If the job is interrupted, it will start from the beginning.
Sequence Divide | Override rrJob setting "Sequence Divide"
Sequence Divide Comp | This overrides the Sequence Divide for Compositing jobs (Note: Denoise has the type "comp" in RR as well)
Memory | Override rrJob setting "Required Memory"
Local Scene Copy | Override rrJob setting "Local Scene Copy"
Little job | Override rrJob setting "Little Job"
Delete output on submission | The rrSubmitter automatically deletes frames that had been rendered before. Useful if you use the Submit Console as it does not have any user interface you ask you if you want to delete existing files
Ignore ROP Inputs | Each ROP is send to the farm "without input connections". This means that the input of a ROP will not be evaluated. Each ROP waits for its input ROPs before it starts to render.
Job Settings | A list of all rrSubmitter options. The format is the same as within the rrSubmitter default files. e.g. RenderPreviewFirst=1~0; SendDisabled=1~1
Job Variables | A list of Custom Job Variables. The format is MyVar=Value; AnotherVar=OtherValue
Env Variables | A list of additional environment variables. The format is MyVar=Value; AnotherVar=OtherValue Note: The Houdini scene variable $JOB is automatically added to the job. If you want to add other scene variables, add them like this: MYCUSTOMVAR=$MYCUSTOMVAR ; MYVAR2=$MYVAR2 Note: You can modify our example on-Submission script in the rrSubmitter as well to add env vars. The python script can automatically include env var XY for render app Houdini.

Scene Overrides

Camera | Override the camera for rendering
Frames | Override the frame range
Resolution | Override the frame resolution
Take | Limit the take to be rendered

## rrDependency

The rrDependency node creates dependencies between jobs, where a job is waiting to be started until a target job is finished.
The order of the incoming nodes controls the dependencies between jobs.
For example, all jobs generated by nodes from the second input are dependent on the jobs coming from the first input.

Example scene using RR Dependency:

Note:
Instead of using the rrDependency nodes, you can check "Ignore ROP Inputs (auto create dependencies)" in the rrSubmitter node as well.

Then each ROP is send to the farm "without input connections". This means that the input of a ROP will not be evaluated.

Note:
As LOPs in /stage do not have any output connection, please use Fetch nodes in /out to combine your LOPs.

## rrPython

Specify a python script that should be executed with Hython.
By default, RR adds these commandline flags that you can read in your python script:
-scene <SceneFile>

-FlagA <FlagA>
-FlagB <FlagB>
-FlagC <FlagC>

-frStart <SeqStart>

-frEnd <SeqEnd>

-frStep <SeqStep>

You do not have to use them in your script.
If you want to other/additional flags and values, please use Additional Commandline Param.

## rrGenericJob

You can submit any Job of any render application with this node.
We have added some render apps and renderer as preset in the dropdown list.
This node can be used to render e.g. a Nuke comp or Denoise that dependends on (waits for) your Houdini ROPs.

## rrDenoise

This ROP is a helper to start different denoise tools.

Of course most denoisers offer a COP to denoise in a Houdini comp.
BUT this requires a Houdini license to process.

General Settings

Input | The input frame sequence to denoise
Output | The denoised files that will be written. Renderman only: Note that the filename (not path) of the output must be the same as the input.
Denoiser | Choose a denoiser.

Houdini

Layer Name (Normal / Albedo / Motion Vector) | Optional. Having one or more of these AOVs as layer in your .exr file improves the denoise quality. If they are in your .exr file, then enter the name of the exr layer in here.
AOVs to denoise | The .exr layers to denoise.
Include Previous Frame | The denoiser loads the previous frame to reduce the frame to frame flickering.
Options - Intel | cleanAux: For further improving quality when the auxilary feature (albedo, normal) planes are noise-free, as described in the OIDN documentation. Default is false. prefilteraux: Whether to pre-filter the albedo and normal auxiliary planes before de-noising the image planes. Default is false.
Options - Optix | Blend between the denoised image (0.0) and the original image (1.0). For example, 0.25 is like overlaying the original image with 25% opacity onto the denoised image. Default is 0.0.

Arnold
Notes:
The required absolute minimum AOVs are the following:

•main layer to be denoised (typically RGBA also known as "beauty")

•variance layer that specifies the per pixel variance

It's recommended to set "preserve layer name" to ON in the output drivers so that the Arnold denoiser can automatically detect what each AOV corresponds to.
Optional Feature Layers

These optional layers are used to guide denoising and will greatly improve the result:

•Normal (N)

•Depth (Z)

•Albedo (denoise_albedo)

Neighborhood Patch Radius | This increases the softness of the denoising (while always preserving the features). The default is 3 (on the big side), but a low value would be maybe 0 or 1, middle 3, and high 5.
Search Radius | This is the area over which similar neighborhoods are found. The higher the better, but it will increase the cost of denoising.
Variance | The strength of the filter is determined by the variance parameter, the higher the variance the more forceful the denoising will be. For variance maybe 0.25 (the default) / 0.5 / 0.75 are good low/min/max values.

Renderman
Notes:
It is required that you enable the "Denoise" option in rendermanrendersettings node.
You need to also un-tick as RGBA under the Display Options

Mode | The single-frame module may produce an animated sequence with severe temporal artifacts—flickering—when executed on a sequence of frames independently. The cross-frame loads 6 frames before and 6 frames after the frame to denoise to reduce this temporal flickering. Note that you might want to add an rrSubmitter ROP to increase the Sequence Divide min/max for Denoise. It depends on your farm load. If a client denoises 1 frame only, then it has to load 1+6 frames. If the Sequence Divide is larger, then these +6 loaded frames are not wasted, they are reused for the next frame.
Flow | The renderman help does not state anything about what it does. ("Whether to compute optical flow"... Thanks for the info...) Pixars denoise developers state: "We either obtain motion vectors from the renderer or use optical flow". Note: These are my own assumptions! I assume that Flow is not required if you have a render motion vector AOV in your .exr. Motion Vectors are always better as Optical Flow. Motion vectors are faster to compute. Optical flow might have issues with fast moving/rotating objects, re-appearing object instances (Forest, Leaves ) or repetive textures (small checkerboard, fractals, pullover fabric, ...).
Asymmetry | A value of 0 removes all noise. But this might not be desired as the image becomes very smooth and you loose a lot of detail. (And compers add noise anyway if the source has no noise) From the renderman help: "0 is the best quality, and higher values encourage the denoiser to avoid overblurring, leading to weaker denoising"

# PGD / TOP graph

Please see PDG/TOP for more information.

# Distributed Simulations

Please see Distributed Sims for more information.

# Solaris Gallery snapshot

You can use Royal Render to render snapshots for your Houdini Solaris Gallery.

## Usage

The first time you want to use Royal Render, you have to tell Houdini that it should use Royal Render for the snapshot generation.
Click on the "Background" button and hold down the mouse button to be able to choose Royal Render.
The next time you want to use Royal Render, a single click on the "Background" button is sufficient.

## Configuration

The configuration opens the first time you use Royal Render.

Or you can open it with a click on the config button.

Render Delegate | Choose the renderer you want to use
Required: USD Directory | You have to specify a (temp) folder for the .usd files on your fileserver. Otherwise the rrClient is not able to find the .usd file.
Optional: Override Gallery Folder | By default, RR renders the images into the same folder as Houdini "Live Render" option. Which is folder $JOB/gallery/$HIP.state/ You may override the folderfor the rendered images.

# API

The Houdini to Royal Render plugin comes with a small API (htorr) to integrate the plugins functionalities into custom tools.

The interface provides a wrapper class for all supported node types.

There are two functions available:

1)

This function executes the same plugin as if you click on submit command in your Houdini Render menu.
If no rops are specified, then it parses all selected ROPs, otherwise all ROPs.

import htorr

submit(rops=[], gui=True, askForSave=True)

2)
An appropriate instance of this class can be created with a `hou` alike method `htorr.node(pathToNode)`.

The returned node wrapper instance has a attribute `jobs`, which is a custom list of all the jobs generated by this node.

To submit a job use the job lists method `submit(gui=True)`.

Example:

import htorr

rrnode = htorr.node('/out/mantra1')

print(rrnode.jobs())

rrnode.jobs().submit(gui=True)

### API Documentation

The plugin is documented via Doxygen.
Natively the support for python in Doxygen is limited. Therefor doxypypy is used, which is a Doxygen filter to enable better python syntax support.
It can be installed via pip with ```pip install doxypypy```.
In order the use it in conjunction with Doxygen the file "py_filter.bat" is needed.

# Examples

This example uses 2 rrSubmitter nodes to be able to override different options for rrJob ".ifd create" and ".ifd render".

The dependency is required to chain the 2 jobs again.
The last rrSubmitter3 node is not required. It was just added to have a Submit button.
You could use the Submit command in the Houdini menu as well.

Merge and switch node parsed upstream:

Combination of RR and Houdini nodes:

Extended combination of RR and Houdini nodes: