Ri for MEL

Ri for MEL

RenderMan for Maya has superb support for RenderMan Attribute and Option control based on Maya attributes. This "data-centric" support is fundamental to Maya's operation and offers advantages for file reference parameter animation and general orthogonality with Maya tools.

There are times where procedural control of RenderMan state is desirable. We offer this capability in RfM through a MEL binding to RenderMan Interface procedures. Whether rendering directly (internally) or to produce RIB, these new commands can be used to tailor the Ri stream via MEL procedures. New torattrs are supported to provide hooks for custom MEL procedures. These can be assigned to shape, light and transform nodes and will be executed when RfM is rendering.

defaultRiOptionsScript

Runs during rendering/ribgen and provides a hook to override rendering options via script control.

defaultRiAttributesScript

Runs during rendering/ribgen and provides a hook to override default rendering attributes via script control.

transformBeginScript

Runs during rendering/ribgen at each transform nodeimmediately following RiAttributeBegin.

postTransformScript

Runs during rendering/ribgen at each transform node immediately following the setup of the transformation state.

transformEndScript

Runs during rendering/ribgen at each transform nodeimmediately preceeding RiAttributeEnd.

preShapeScript

Runs during rendering/ribgen at each shape node immediatelypreceeding geometry output.

postShapeScript

Runs during rendering/ribgen at each shape node immediately following geometry output.

Ri Command Syntax

Ri commands fall into two broad syntactic classes: commands with and commands without variable length parameter lists. Those commands without variable length parameter lists generally accept typed, positional arguments following the RIB binding conventions. For example, a red color is specified this way:

RiColor 1.0 0.0 0.0

Since Ri parameter lists are comprised of a heterogeneity of types, we follow the Ri-convention that requires parameter-type declarations be provided. Modern practice combines the type declaration with the parameter name to produce an inline declaration.

Inline Declaration Syntax

"type name" ''value''
"type[arraylen] name" ''value1'' ... ''valueArrayLen''

Parameterlist Examples

RiAttribute "identifier" "string name" "myname"
RiAttribute "visibility" "int camera" 1 "int trace" 0
RiSurface "mySurfaceShader" "string[2] myFiles" "file one" "file two"
         "float Ks" 1.0 "float[5] myweights" 1 2 3 4 5;

Scope

RiBegin filename_string
RiEnd
RiFrameBegin frame_int
RiFrameEnd
RiWorldBegin
RiWorldEnd
RiAttributeBegin
RiAttributeEnd
RiTransformBegin
RiTransformEnd
RiSolidBegin operation_string ("primitive", "intersection", "union", "difference")
RiSolidEnd
RiResourceBegin
RiResourceEnd

Options

RiOption namespace_string ...parameterlist...
RiHider hidername_string ...parameterlist...
-
RiFormat xres_int yres_int pixelaspectratio_float
RiPixelSamples xsamples_int ysamples_int
RiScreenWindow left_float right_float bottom_float top_float
RiCropWindow xmin_float xmax_float ymin_float ymax_float
RiProjection projtype_string ...parameterlist...
RiClipping near_float far_float
RiDepthOfField fstop_float focallength_float focaldistance_float
RiShutter min_float max_float
-
RiDisplayChannel channeldecl_string ...parameterlist...
RiDisplay name_string type_string mode_string ...parameterlist...
-
RiRelativeDetail relativedetail_float

Attributes

RiAttribute namespace_string ...parameterlist...
RiColor red_float green_float blue_float
RiOpacity red_float green_float blue_float
-
RiSurface shadername_string ...parameterlist..
RiDisplacement shadername_string ...parameterlist..
RiAtmosphere shadername_string ...parameterlist..
RiInterior shadername_string ...parameterlist..
RiExterior shadername_string ...parameterlist..
-
RiLightSource shadername_string lighthandle_string ...parameterlist...
RiIlluminate lighthandle_string onoff_bool
-
RiShadingRate size_float
RiGeometricApproximation type_string value_float
-
RiShadingInterpolation interp_string  (smooth, constant)
RiMatte onoff_bool
-
RiDetail minx maxx miny maxy minz maxy (floats)
RiDetailRange minvisible lowertransition uppertransition maxvisible (floats)
-
RiSides sides_int  (1 or 2)
RiOrientation orientation_string  (lh, rh, inside, outside)
RiReverseOrientation
-
RiResource handle_string type_string ...parameterlist...

Transform

RiIdentity
RiRotate angle dx dy dz (floats)
RiScale sx sy sz (floats)
RiSkew angle dx1 dy1 dz1 dx2 dy2 dz2 (floats)
RiTranslate x y z (floats)
RiCoordinateSystem  coordsysname_string
RiScopedCoordinateSystem coordsysname_string

Geometry

RiSphere radius zmin zmax angle ...parameterlist...
-
RiProcedural (work only with RIB out)
RiProcedural "DelayedReadArchive" filename xmin xmax ymin ymax zmin zmax
RiProcedural "DynamicLoad" dsoname xmin xmax ymin ymax zmin zmax ...paramlist...