Snippet of how to pass (parse) environment variables to RenderMan.

Option "ribparse" "string varsubst" [""]
Option "ribparse" "string varsubst" ["$"]
Attribute "user" "string renderversion" ["${RMANVERSION}"]
Display "${renderversion}/beauty.0001.exr" "openexr" "openexr" "Ci,a" "int asrgba" [1]

Rendering Product Placement

Providing example scenes files for Maya + RenderMan + Nuke in order to produce the following product image.
Download Project Here (5.06MB)

Unzip contents into your Maya projects directory. Produced using the following software versions.

  • Maya 2018.5
  • RenderMan 22.4
  • Nuke 11.2v4


Udim is an abbreviation of U-Dimension. It’s a tile-indexing system that converts a 2d (UV) coordinate into a 1d (Udim) tile.

To convert UV coordinates into Udim.

$udim = floor(($v) * $maxu + ($u + 1) + $base);
$u = U coordinate.
$v = V coordinate.
$maxu = Maximum in U dimension, 10 is industry standard.
$base = The origin. 1000 is the industry standard.

To convert a Udim back into it’s UV coordinates.

$u = int($udim-base) % $maxu
$v = int(floor(($udim-$base) / $maxu))

Renderman Development On Windows

Windows development for CG is always a bit of hassle as much of the tools out there come from development inside studios using Linux – where it’s often being much simply to build source code from scratch.

Pixar provide source code and examples for much of their plugins as developer examples. You won’t find source code for things like PxrSurface which contain Pixar’s secret sauces – but you will find quite a lot of useful ingredients to get you started.

The following is based on Renderman 22. Very specifically it’s worked for me on R22.2 and R22.3 – I’ve not tried earlier or later versions – but hopefully much of this applies to R21 and other points releases of R22.

To get the developer examples, run the Renderman Installer and when you get to the packages to install click on Show All. The Examples will be downloaded to your Downloads folder as a compressed archive (use 7zip to extract it)

Image showing dialog box from Renderman Installer application.
Click the Show All box when running the Installer application.

I’ve been using Visual Studio 2017 Community Edition to do this.

In order to compile the examples on Windows using Visual Studio, the easiest way I’ve found is to use the Visual Studio Command Prompt. In particular the x64 Native Tools Command Prompt for VS 2017.

>cd D:\scenes\rman\dev\PixarRenderMan-Examples-22.2_1903500-windows10_vc14icc170.x86_64\plugins\pattern\color
>cl -c "-I%RMANTREE%\include"  /D "WIN32" /D "_WINDLL"  /EHsc  PxrMix.cpp
>link /out:PxrMix.dll /dll "/libpath:%RMANTREE%\lib" "PxrMix.obj" libprman.lib

This should give you a DLL file, you can copy this into your Documents/rfm folder in order to use in Renderman, however in order to use it in RfM you’ll need to have a Args file which defines it’s parameters. Args files come from Katana and Pixar uses them to define the UI of plugins in both Katana and Maya.

The easiest way to create an Args file is just modify an existing one. For example, if you look in the $RMANTREE/lib/plugins/Args you’ll find the current ones (including PxrMix from the above example).

Renderman and Paint Effects

The following information relates to the following video.

Renderman has access to the following data on a Paint Effects stroke. The most useful one is Cs (colour).

  • data – how the data attaches to the geometry, varying and vertex both attach to vertices, uniform attaches to each face and constant attaches to the whole mesh
  • type – what type of data is it – color, float, point, vector, normal
  • name – name of the primvar
  • description – a brief description of what the data contains
[data] [type] [name] (description)
vertex normal N (surface normal)
varying float width (width of curve)
vertex float t (length along curve)
varying color Cs (color on curve
vertex point P (position along curve)

These can be used with PxrPrimvar or PxrVariable.

Simple script to help assign Renderman materials to Paint Effects strokes in Maya. To use is easy, select paint strokes and then the PxrSurface you wish to use and run the code.

import pymel.core as pym

mypaintfx = pym.ls (sl=True, fl=True, dag=True, ni=False, type="stroke")
mypxrsurface = pym.ls (sl=True, fl=True, dag=False, ni=False, type="PxrSurface")

myconnection = pym.listConnections('%s.outColor' % str (mypxrsurface[0]))

for x in mypaintfx:
    pym.connectAttr( '%s.message' % str(myconnection[0]), '%s.rman__torattr___customShadingGroup' % x, force=True )

Information based on using Renderman 22.1 and Maya 2018.2, for those curious- these frames took about 3mins at HD resolution and contain about 1.6 million curves.

Renderman + Masks

New video up on generating masks (mattes) in Renderman for Maya.

Here’s a quick script to connect up a single PxrMatteID node to many PxrMaterial nodes.

import pymel.core as pym
mynodes = pym.ls (sl=True, fl=True, dag=False, ni=True)

mybxdfs = []
myhairs = []
mymatteid = []

for x in mynodes:
    if isinstance(x , (pym.nodetypes.PxrSurface, pym.nodetypes.PxrLayerSurface)):
    if isinstance(x , ( pym.nodetypes.PxrMarschnerHair)):
    if isinstance(x , (pym.nodetypes.PxrMatteID)):

if len(mymatteid) == 1:
    for b in mybxdfs:
        mymatteid[0].resultAOV.connect(b.utilityPattern[0], force=True)
    for h in myhairs:
        mymatteid[0].resultAOV.connect(h.inputAOV, force=True)        
elif len(mymatteid) != 1:
    print 'too many PxrMatteID nodes selected, just try one'


Renderman – Batch Render tips

In the Batch Render options. Two useful settings.

  1. Checkpoint Interval. First number is how often to save the file when rendering. Second is when to finish rendering. Here I’ve set it to save a copy every 30 minutes and don’t render any longer than 24 hours.
  2. Renderer Arguments. This additional argument prints out the current memory and percentage of render complete. Handy to know where you are.