RenderMan consists entirely of procedure calls whose names begin with 'Ri'. The user then calls a procedure to add a surface to a scene or to modify a parameter.
The concept of tokens and scopes was not well documented in. In these concepts where extended in an upward compatible way. This section describes the new definition.
Tokens are strings that can be passed to certain requests to identify optional parameters. A token is always passed in combination with a value. This is called a token-value pair (e.g. "fov" 45). The most important use of token-value pairs is to pass parameters to shaders. In order to use a token it must be declared using RiDeclare() as either a scalar or an array of float, point, color or string type. But there are other applications as well. For example, to pass the control points of a bezier patch the predefined token `` P'' (predeclared to represent an array of points) is used. Other predefined tokens identifying seldomly used options or attributes exist.
If a tokens is used to pass a parameter to a user defined shader, it must be of the same name as the shader parameter and declared of the same type. This token can then be (followed by the new value) passed to a request (for example RiSurface() or RiImager()).
For example to pass pass a value for the "size" parameter to a "checkerboard" surface shader (defined by surface checkerboard(float size)) the following has to be done:
RtFloat size=10; RiDeclare("surface:checkerboard:size","float"); RiSurface("checkerboard","surface:checkerboard:size",&size,NULL);This shows another concept introduced with QuickRenderMan: qualified token names. In the original RenderMan definition there was only one global name space in which all tokens where defined. This lead to problems when two shaders have a parameter with the same name but with different types. The qualification of names is optional (both during declaration and access). A qualified name is composed of three parts (parts in `` {}'' are optional):
{{namespace:}table:}var`` namespace'' is either a shader class (`` surface'', `` lightsource'', ...) or one of the implementation-definable interface extensions (`` attribute'', `` option'', ...). `` table'' is the name of the shader, and `` var'' is the name of the parameter.
In order to be compatible with the old RenderMan definition the following is legal and has the same results when there are no name conflicts:
RtFloat size = 10; RiDeclare("size","float"); RiSurface("checkerboard","size",&size,NULL);
Another use of tokens is to pass automatically interpolated values (according to the parameterization of the surface the shader is attached to) to surface and area lightsource shaders. These parameters are then called varying parameters:
RtFloat size[] = {1,2,3,4}; RiSurface("checkerboard",NULL); RiSphere(1, -1, 1, 360, "size", size,NULL);The value of a token-value pair is then an array of 4 values which specify the value of the parameter at the vertices ( (s,t)=(0,0), (s,t)=(0,1), (s,t)=(1,0), (s,t)=(1,1)) of the surface.
A short overview of the blocks has been given in the introduction to this section. In general at the beginning of a block some part of the current state is pushed on a stack. This state is reset by the matching bock end. Additionally, blocks separate different parts of a scene description from each other. For example the world block separates the description of the geometry from the section describing the virtual camera and the options for the image.
The following blocks are available:
An object is identified by a string name (a handle) which is passed to the RiObjectBegin(), as well as to the RiObjectInstance() request.
Options are used to control the overall appearance of an image. They specify the used rendering technique, which part of the frame is rendered, the name of the generated file, etc. The available requests to change options are:
RiFormat()
RiFrameAspectRatio()
RiScreenWindow()
RiCropWindow
RiPerspective()
RiClipping()
RiDepthOfField()
RiShutter()
RiPixelVariance()
RiPixelSamples()
RiPixelFilter()
RiExposure()
RiImage()
RiQuantize()
RiDisplay()
RiHider()
RiColorSamples()
RiRelativeDetail()
RiOption()
One other important part of the options is to define the viewing transformation, the position of the camera. This is done using the requests changing the current transformation. The position and viewing direction of the virtual camera is determined when RiWorldBegin() is called.
RiErrorHandler(handler) RtFunc handler;
Copyright - Sudhir R Kaushik (sudhir@cs.wpi.edu)