Blue Moon Rendering Tools 2.4
Part 7: Miscellaneous Tools and Goodies
revised 27 August 1998
Larry I. Gritz
gritzl@acm.org
7.1 Parsing Shader Arguments with libslcargs.a
Pixar's PhotoRealistic RenderMan implementation provides a
linkable library which allows a developer to read a compiled shader
file (.slo) to determine what type of shader it is and what parameter
names and defaults belong to that shader. Since Pixar's .slo format
is different from BMRT's .slc format, a similar library is provided to
parse the .slc files. The library is libslcargs.a, and the C language
header file is slc.h. The slc.h file should be fairly self-documenting,
and certainly anybody with experience using Pixar's libsloargs.a
library ought to have an easy time of using libslcargs.a.
7.2 Using slctell to list shader arguments
Another binary, slctell, reports the type of shader and its
parameter names and default values. Usage is simple: just give the
shader name on the command line (NOT the file name). For example,
slctell plastic
reports:
surface "shaders/plastic"
"Ka" "uniform float"
Default value: 1
"Kd" "uniform float"
Default value: 0.5
"Ks" "uniform float"
Default value: 0.5
"roughness" "uniform float"
Default value: 0.1
"specularcolor" "uniform color"
Default value: "rgb" [1 1 1]
7.3 Simple Image Compositing with composite
Starting with release 2.3.6, BMRT includes a program to perform
elementary image compositing operations. If you render your images
with alpha channels (i.e. "rgba"), then coverage information will be
stored with every pixel in the image. For the purposes of
composite, RGB images without alpha channels will be assumed
to have an alpha of 1.0 at every pixel.
composite may be run as follows:
- composite file1 over file2 -o output
- composite file1 in file2 -o output
- composite file1 out file2 -o output
- composite file1 atop file2 -o output
- composite file1 xor file2 -o output
- Composite images file1 and file2 using one of
the standard image compositing operators described in (Porter & Duff,
"Digital Image Compositing", Proceedings of SIGGRAPH '84,
pp. 253-259), storing the composited image in file output.
- composite file1 plus file2 -o output
- composite file1 minus file2 -o output
- Add or subtract two files, storing the results in file
output. Pixels are clamped to [0,maxval], where maxval==255
for 8 bit images, maxval==65535 for 16 bit images.
- composite file1 scale float -o output
- composite file1 dissolve float -o output
- composite file1 opaque float -o output
- These three unary operators take a floating point number, rather
than a filename, as their second operand. They all scale the channels
of the image, but in slightly different ways. The scale
operator multiples the RGB channels, but leaves the alpha alone --
i.e. it can brighten or darken an image without changing its
transparency. The dissolve operator scales the alpha along
with the RGB. Finally, the opaque operator will scale
only the alpha channel.
Hint for beginners: you probably want over.
7.4 Making tiled TIFF files with mkmip
BMRT has always used TIFF files for stored image textures (as
opposed to PRMan, which requires you to convert to a
proprietary texture format). Beginning with BMRT 2.4, though BMRT
will continue to accept regular scanline (or strip) oriented TIFF
files, it is able to perform certain optimizations if the TIFF files
you supply happen to be tile-oriented. In particular, BMRT is able
to significantly reduce the memory needed for texture mapping with
tiled TIFF files.
A new program supplied with BMRT, mkmip, can convert
scanline TIFF files into multiresolution, tiled TIFF files. Command
line usage is:
mkmip [options] infilename outfilename
where options include:
- -smode wrapmode
-tmode wrapmode
-mode wrapmode
- where wrapmode is one of: periodic, black,
or clamp. This specifies the behavior of the texture when
outside the [0,1] lookup range. Note that -smode and
-tmode specify wrapping behavior separately for the s and
t directions, while -mode specifies both at the same time.
7.5 Setting default options and attributes
Remember that both of BMRT's renderers (rendrib
and rgl) read from a file called
.rendribrc both in the local directory where it is run, and
also in your home directory. This file can be plain RIB, which means
that if you want to set any defaults (default resolution, shader
search path, texture cache size, etc.) you can just put the Option or
Attribute lines in this file in your home directory.
7.6 farm: Poor Man's Render Farm
Many people ask how they can divide rendering of a single frame among
several processors or machines. Starting with BMRT 2.4, the Perl
script farm accomplishes this task, in a relatively rudimentary
way.
How to use farm
Set the environment variable BMRT_FARM
to be a
blank-separated list of the names of machines which can be
used as render servers. Machines with multiple processors should
be listed multiple times. For example, if you have a machine
named "fred" with two processors, and one named "wilma" with
one processor, then run:
setenv BMRT_FARM "fred fred wilma"
if you use csh
. If you use sh
, try:
export BMRT_FARM="fred fred wilma"
Make sure that rendrib is in the default path of each
remote machine, and that mkmosaic is in the path
on the local machine.
Run farm:
farm myfile.rib
What farm does
First, farm will look at your RIB file to figure out the
resolution and the name of the TIFF file that it will render. It will
choose an appropriate number of subwindows to render.
One by one, it will send the frame to machines on your
BMRT_FARM
list, using the -crop
and
-of
flags to make rendrib render particular
crop windows. Machines whose load averages are too high will
automatically refuse the frames.
When farm sees that all the subsections are finished (each
will leave a little file indicating that it's done), it will assemble
all the pieces using the mkmosaic program, and clean up all
the cruft files.
Important farm restrictions
- Because farm relies on rsh, you can only use
it on UNIX (or UNIX-like) operating systems.
- You can't use farm to render to the display (the -d flag).
It must be rendering to a TIFF file.
- Don't try using any other rendrib command line flags. Request
all image options (like radiosity options) in the RIB file with
Option and Attribute statements.
- Hitting Control-C to interrupt farm will kill only
farm, but will leave the individual crop windows rendering
on the remote machines. Beware.
- [Upstill89]
- Upstill, Steve. The RenderMan Companion: A Programmer's
Guide to Realistic Computer Graphics. Addison-Wesley, 1989.
- [Pixar89]
- Pixar. "The RenderMan Interface, version 3.1 official
specification." Published by Pixar, 1989.
- [Apodaca90]
- Apodaca, A., ed. "The RenderMan Interface and Shading
Language," Siggraph '90 course notes (course 18), 1990.
- [Apodaca92]
- Apodaca, A., ed. "Writing RenderMan Shaders," Siggraph '92
course notes (course 21), 1992.
- [Apodaca95]
- Apodaca, A., ed. "Using RenderMan for Animation Production,"
Siggraph '95 course notes (course 4), 1995.
- [Apodaca98]
- Apodaca, A. and L. Gritz, eds. "Advanced RenderMan: Beyond the
Companion" Siggraph '98 course notes (course 11), 1998.
- [Gritz93]
- Gritz, Larry. "Computing Specular-to-Diffuse Illumination for
Two-Pass Rendering," Master's Thesis, The George Washington
University, Dept. of EE & CS, May, 1993.
- [Gritz94]
- Gritz, Larry. "RenderMan for Poets," Technical Report
GWU-IIST-94-05, Dept. of EE&CS, The George Washington University,
1994.
- [Gritz96]
- Gritz, Larry and J. Hahn. "BMRT: A Global
Illumination Implementation of the RenderMan Standard," Journal of
Graphics Tools, Vol. 1, No. 3, pp. 29-47 (1996).
This document last updated 27 Aug 98 by gritzl@acm.org
All BMRT components are Copyright 1990-1998 by Larry I. Gritz.
All rights reserved.
The RenderMan Interface Procedures and RIB Protocol are:
Copyright 1988, 1989, Pixar. All rights reserved.
RenderMan is a registered trademark of Pixar.