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

 

OSL – BlackBody Colour

This node outputs a normalised colour given an input temperature in degrees Kelvin. This can be used as an input for lights to give the effect of different colour temperatures.

Download Here

BlackBodyColour Controls
BlackBodyColour Controls
  • Temperature: Temperature in degrees Kelvin.

 

OSL – Constant Surface

This shading node acts as a constant surface shader. It can be used to output flat colour without any shading (diffuse, specular, etc) on an object.

Download Here

Constant Controls
Constant Controls
  • EmissionOn: When set to 0 it will only compute the InColour for Camera rays. This prevents it from bleeding light onto surrounding surfaces. When set to 1 it will behave as OSL intended it as act as an emissive light, which bleeds light onto surrounding surfaces.
  • InColour: The input colour. Can be constant or texture.

Note that when EmissionOn is set to 1 it will take a lot longer to compute than when EmissionOn is set to 0.

OSL – ColourSwitch

This shading node does a binary switch between two input colours. Potentially useful if you want to test out two different textures or colour settings and don’t wish to rewire your shading network.

Download Here

ColourSwitch Controls
ColourSwitch Controls
  • Which: Which colour input to use. 0 = InColour0 and 1 = InColour1.
  • InColour0: Input Colour 0
  • InColour1: Input Colour 1

 

OSL – Exposure

This shading node applies an exposure adjustment to the input colour. This allows you to manipulate the colour using photographic stops.

Download Here

Exposure Controls
Exposure Controls
  • Active: Disable the effect by setting this to 0. This allows you to disable the adjustment without having to rewire your shading network.
  • InColour: The input colour. This can be any type of colour (texture, constant, etc)
  • Exposure: Measured in stops. Each stop will increase (double) or decrease (halve) the brightness.