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 https://renderman.pixar.com/forum/showthread.php?s=&threadid=35595 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 WorldBegin Sphere 100 -100 100 360 AttributeBegin # 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] AttributeEnd WorldEnd
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.
One thought on “Renderman Commandline”