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.


Playing around with PxrSeExpr

This got started from a question on the Renderman forums about the difference between ST and UV. Renderman uses UV and ST to differiate between “implicit” and “explicit” texture coordinates. Implicit is automatically defined by the geometric shape and explicit is manually defined by the user.

With polygons and subdivision geometry, Renderman uses ST coordinates for texture mapping (it converts Maya UVs to Renderman STs behind the scenes). But it also automatically assigns UV coordinates to each face on the geometry, you might ask why would you need this?

For fun and profit!