To render an image, a complete scene description must be supplied. The majority of the information is given in a file that contains RenderMan Interface requests specified with the RenderMan Interface Bytestream protocol, RIB. For shading, however, this description may reference functions written in the RenderMan Shading Language. These functions are maintained separately, in ASCII files that must be compiled by the RenderMan Shading Language compiler shader before they can be used. In addition, if the shading calculations use texture files, these files must be made available to PhotoRealistic RenderMan. Many textures are created from previously rendered images, in which case the rendered images must first be converted to a format optimized for efficient access as a texture.
RenderMan Interface scene descriptions for PhotoRealistic RenderMan are specified with RIB. RIB is basically a language-independent specification mechanism for calls to the RenderMan Interface. This specification can be created in ASCII or, for efficiency, in a compressed binary format. The modeling system used to generate scene descriptions is expected to output RIB, usually by using the RIB client library, librib.a, that is described in The RenderMan Interface Bytestream Protocol Library.
PhotoRealistic RenderMan supports RIB files, in either binary or ascii forms, with or without gzip compression. See PRMan Options: RIB Output for details on controlling the format of RIB files.
One tool that can be useful in dealing with RIB files is the program catrib. Catrib can be used to convert between binary and ASCII formats, and as a means of transmitting RIB data to a rendering server. For example, if the file binary.rib contains binary RIB data, then the following will create an ASCII version of this data in the file ascii.rib:
catrib -ascii binary.rib > ascii.rib
By default the output generated by catrib is sent to the standard output. Thus the following might be used to compare the ASCII output to a previously created file:
catrib -ascii binary.rib | diff - oldascii.rib
The format of the output generated by catrib can be specified as binary or ASCII by using the -binary and -ascii options, respectively. Alternatively the environment variable RIFORMAT can be set to "binary" or "ascii". Beware, however, that this environment variable is also used by the client RIB library that applications use to generate RIB data. Thus setting this environment variable may also affect the operation of your modeling system.
Shaders are routines written in the RenderMan Shading Language. These routines have a number of functions in the rendering process. Shaders can be used to perturb geometry, describe light sources, define surface characteristics, etc.
Each shader must be compiled before it can be used by PhotoRealistic RenderMan in the rendering process. This is done with the shader program. For example, to compile the constant shader into a shading file suitable for use by PhotoRealistic RenderMan the following command would be used:
shader constant.sl
Each shader must be compiled into a separate file and the file that holds the compiled object must have a name that corresponds to the name of the enclosed shader. For example, the file constant.slo holds the shader named constant. A file named foo.sl might contain the shader surface marble. Its corresponding output file (created by the compiler) would be marble.slo and not foo.slo. This file naming convention is automatically enforced by the shader compiler; you need only be aware of this if you have source files whose names do not match the name of the enclosed shader.
The standard shaders defined in the RenderMan Interface specification are located in the directory $RMANTREE/lib/shaders. (See Table 1.) PhotoRealistic RenderMan automatically searches this directory to find shaders that are referenced in a scene description. Any user-defined shaders must be referenced either through absolute path names (i.e., path names with a leading slash) or by using the PhotoRealistic RenderMan-specific searchpath option. See Configuration Files and PRMan Options: Search Paths for details about search paths.
Shader | Description | |
---|---|---|
ambientlight | ambient light source | |
constant | constant-color surface without light effects | |
distantlight | light source at infinity | |
defaultsurface | the default surface shader | |
depthcue | depth cueing atmosphere shader | |
fog | foggy atmosphere shader | |
matte | purely diffuse color surface | |
metal | shiny metallic surface | |
null | general null shader | |
plastic | plastic-like surface | |
spotlight | conical light source with exponential fall-off |
Texture files contain data that may be used in the shading process through the texture, environment, bump and shadow operators. In order to allow for texture files that can optimize the access patterns typically seen during rendering, PhotoRealistic RenderMan requires that texture files be converted into one of two formats:
PRMan will transparently access texture files in either format. When creating these texture files, the default texture format is controlled by the /prman/textureformat option in the configuration file; this may be overridden by a parameter to RiMakeTexture, or a command line option to txmake.
To create a texture file from a picture file the standalone txmake utility can be used. For example:
txmake wood.tif wood.tex
A manual page for this program is provided in the PhotoRealistic RenderMan Reference Documentation section of this volume. This is a useful alternative to the RiMakeTexture routine. In either case, texture files must be created before they are used.
The source picture files that txmake and RiMakeTexture use to create texture maps can be in one of many image formats, including: TIFF, Alias, mayaiff, Radiance, JPEG, and SGI RGB. Source images for texture maps or environment maps can be any resolution; however, the texture making process causes these files to be resized into various other resolutions for fast filtered access, each being some even power of two resolution in both width and height. The user has some control of this filtering process with the -resize option of txmake (or equivalently, the resize parameter of RiMakeTexture). By default, the file is first resized up to the next highest power of two resolution in each direction, using a high-quality Catmull-Rom filter. Other possibilities include resize down to the next lower power of two resolution, and round the resolution to the closest power of two. In all three cases, information about the original image aspect ratio is retained within the file so that the texture is not stretched when it is applied to simple surfaces. (The behavior of previous releases of PhotoRealistic RenderMan to fill images with black pixels, rather than resize them, can be requested with resize value of none.)
Source images for shadow depth maps must be power of two resolution, as this resizing functionality is not implemented for shadow depth maps. If the source depth files do not have an even power of two resolution, the shadow maps will not produce correct shadows.
Texture file names should either be given as absolute path names or through the PhotoRealistic RenderMan-specific searchpath option. See Configuration Files and PRMan Options: Search Paths for details about search paths.
PhotoRealistic RenderMan provides two utility programs (in addition to txmake) to manipulate texture files. Manual pages for these programs are provided in the PhotoRealistic RenderMan Reference Documentation. The programs are: sho, used to display texture images using the PhotoRealistic RenderMan display server, and txinfo, used to print descriptive information about a texture file.
PhotoRealistic RenderMan is designed to be portable; it runs on a wide variety of machines and under a number of different operating systems. PhotoRealistic RenderMan typically functions as a single self-contained program, except for some display services. The rendering algorithm, texturing facilities, shading language interpreter, etc. are all integrated into a single program that runs as a single process and allocates memory through the standard system facilities.
PhotoRealistic RenderMan is invoked using the prman executable. To render a model file containing RIB data, simply use:
prman model.rib
It is often convenient to store options, camera specification and the world block in separate files. prman can be given multiple file names and it will process them in the order given:
prman options.rib camera.rib world.rib
Note, however, that file is an optional argument; prman can take RIB from stdin (standard input).
The prman executable accepts several command-line options:
The images created by PhotoRealistic RenderMan can be placed into a file or onto a frame buffer device via an appropriate display driver. PhotoRealistic RenderMan is shipped with display drivers that support image output in various file formats and display devices. These drivers are described in Display Drivers. The default file format is TIFF. The default framebuffer is either the x11 or windows, which render to a window on the local system display. To select one a driver that is not the default file or framebuffer driver use RiDisplay as follows:
RiDisplay("filename", "driver", ...);
where driver is the name of the display driver. The driver may or may not use the filename argument. When output is directed to a file, the name of the file is the name specified in the RiDisplay command. If the file name is not an absolute path name, the file is created in the directory in which rendering is performed.
RGBA, RGB, or single channel (R) pixels can be generated with the precision selected by the appropriate RiQuantize request. For example, to output 8-bit RGB data in a file named foo.tif:
RiQuantize(RI_RGBA, 255, 0, 255, .5); RiDisplay("foo.tif", RI_FILE, RI_RGB, RI_NULL);
Extensions to the RiDisplay call beyond the RenderMan Specification are documented in PRMan Options: Frame Buffer Control.
Several environment variables are used to control the operation of the PhotoRealistic RenderMan system. The values of these variables are modified with the UNIX setenv command. The following is a list of these variables and how they are interpreted.
Some of the display drivers also use environment variables. See the documentation for the individual drivers in the Reference Documentation.
Many of the internal defaults of PhotoRealistic RenderMan can be controlled by configuration files named rendermn.ini. These configuration files are read at the time of the call to RiBegin, before any other Ri calls are processed. For defaults that correspond to an Ri call, the Ri call, if present, will override the default value.
The initial configuration file rendermn.ini is found in the directory ${RMANTREE}/etc. After the initial configuration file has been scanned, additional configuration files will be scanned their settings will override any values set in the initial configuration file. These additional files are named rendermn.ini and they are searched for in both the directory defined by the environment HOME and in the current directory, in that order. (The file in the HOME directory can optionally have a leading "." to make it a hidden file.)
The configuration file format is a set of lines containing strings. The first string on the line is the name of the default and the rest of the line specify its default value. Environment variables may be referenced inside the configuration file using the following special syntax:
${environment-variable-name}
Undefined environment variables default to the empty string, except for ${RMANTREE}, which defaults to /usr/local/prman. Lines beginning with a # are ignored. The following is a list of the defaults that can be set in configuration files that are relevant to PhotoRealistic RenderMan. Note that there are also various display drivers that also read defaults from this file, and those defaults are documented in the Reference Documentation.
Following is an example configuration file:
/displaytype/file tiff /display/tiff/compression zip /display/tiff/xres 640 /display/tiff/yres 480 /display/tiff/par 1 /errorpath ${RMANTREE}/etc/messages /dspyserver ${RMANTREE}/etc/dspyserver /licensefile ${RMANTREE}/etc/license.dat /standardshaderpath ${RMANTREE}/lib/shaders /standardtexturepath ${RMANTREE}/lib/textures /shaderpath .:@ /texturepath .:@ /prman/bucketsize 12 12 /prman/gridsize 512 /prman/texturememory 8192 /prman/shadingrate 1
Pixar Animation Studios
|