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.

>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 Commandline

A video about setting up and using Renderman on the commandline.

The rib example for the OSL section below comes from a question by rheiland on the Pixar forum Thank you, it’s a really simple and helpful example.

Copy and paste the first bit of code into a file called balls.rib

Display "foo" "it" "rgba"
Format 400 400 1
Projection "perspective" "fov" 25

Translate 0.0 0.0 2.75
Rotate -120 1 0 0

Sphere 100 -100 100 360

# this will use Pixar provided patterns
 Pattern "PxrPrimvar" "MyPxrPrimvar" "string varname" ["Cs"] "string type" ["color"] "string coordsys" [""]
 Bxdf "PxrDisney" "bxdf" "reference color baseColor" ["MyPxrPrimvar:resultRGB"]

# uncomment the next two lines to use a custom OSL pattern
 #Pattern "Primvar" "CustomPrimvar" "string PrimvarName" ["Cs"]
 #Bxdf "PxrDisney" "bxdf" "reference color baseColor" ["CustomPrimvar:OutColour"]

# This creates 4 fours, each of different sizes and colours.
 Points "P" [-0.5 0 0.0 -0.3 0 0 0.3 0 0 0.5 0 0 ]
 "width" [0.10 0.12 0.14 0.16]
 "varying color Cs" [1 0 0 0 1 0 0 0 1 1 1 0]


Switch to commandline and use this following command.

prman -d it -t:-2 balls.rib

You should get the following image.

To use the OSL. Copy/paste the following text into a file called Primvar.osl

shader Primvar[[
 int rfm_nodeid = 110,
 string rfm_classification = "rendernode/RenderMan/pattern",
 string help = "Primvar"
 string PrimvarName = "",
 output color OutColour = 0,
 output float OutFloat = 0
 color Cs;
 getattribute("primvar", PrimvarName, Cs);
 OutColour = Cs;
 OutFloat = Cs[0];

Then compile it from the commandline using the the following command..

oslc Primvar.osl

Copy the resulting Primvar.oso file into the same directory as your rib file, adjust the comments in there are try again. You should get the same image, you’ve just done it using your own OSL code which you can modify to do other things.


Batch – Using ffmpeg to create DNxHD quicktimes

Recently been going over my reel footage and decided it was time to convert everything into the same format, rather than have a collection of different AVI and MOV files all with different codecs.

I decided to go with Avid DNxHD36 as it plays and edits nicely on my machine.

I’m using the following windows batch file to drag n’ drop the files I want converted onto. They then go to a folder for sorting.

@echo off
if [%1]==[] goto :eof
ffmpeg -i %1 -vf "scale=1920:1080" -vcodec dnxhd -r 23.976 -b:v 36M "d:/media/dynamic/"
if not [%1]==[] goto loop

Works pretty good, only issue is it only works for footage which is or is-supposed-to-playback-as 16:9.