IntroductionThe python scripts presented here are intended to illustrate some of the tasks that Rifs can perform. The reader should review the tutorial RfM: Batch Filtering before continuing with this tutorial. Using the Rifs with Maya
Using the batchRenderRI() proc with Maya (see RfM: Batch Rendering)
a Rif or Rifs may be specified as follows.
batchRenderRI("rif_it", 1); or batchRenderRI("rif_it.Rif(), 1");
The second arg indicates whether "rman genrib" should be used to generate a fresh set of ribs.
If only the name of module is specified then ribops.py assumes the name of the
class is 'Rif'. Therefore, batchRenderRI("rif_it;rif_meshToBlobby(0.5)"); Note the use of a semi-colon to separate the names of the Rifs. Spaces must not appear anywhere within the double quotations. String arguments must be specified with single quotes ie. batchRenderRI("rif_it;rif_shadinginterpolation('smooth'), 1"); |
Example 2: Converting a Standard Blobby to a VolumeThe third Rif converts a "standard" blobby produced by, say, a Maya particle emitter to a blobby that can be rendered as a volume primitive. A typical Maya/RfM rib archive that defines a standard Blobby primitive will look like this, ##RenderMan RIB version 3.04 Blobby 3 [1001 0 1001 16 1001 32 0 3 0 1 2] [1 0 0 0 0 1 0 0 0 0 1 0 -0.5 0.2 0.0 1 1 0 0 0 0 1 0 0 0 0 1 0 0.9 0.5 0.0 1 1 0 0 0 0 1 0 0 0 0 1 0 0.5 -0.5 0.0 1] [""] When rendered the Blobby would appear as shown in figure 2. But when converted to a volume primitive and rendered with an appropriate surface shader it will look completely different - figure 3. |
|
|
A Blobby can be rendered as a volume primitive if its sequence of opcodes begin with 8. Blobby 3 [8 1001 0 1001 16 1001 32 0 3 0 1 2] ...transformation data... Currently RMS (version 3) does not provide a convenient way of specifying a Blobby as a volume primitive. The Rif shown in listing 3 adds the required opcode. Listing 3 (rif_volumeblobby.py)
|
Example 3: Converting a Polymesh to a Blobby
The next Rif converts all polymeshes, specified in a
rib by the Listing 4 (rif_meshToBlobby.py)
|
Example 4: Changing the Width of Points
This Rif changes the diameter (constantwidth) of the points defined by the rib
Listing 5 (rif_points_width.py)
|
Example 5: Substituting Archives for Points
This Rif reads the xyz locations of the points defined by the rib
Listing 6 (rif_points_archive.py)
|
|
|
Example 6: Changing the Size (Scale) of a BlobbyThis Rif receives a tuple of transformation values, 16 per blob, in the xyz argument. For ease of handling, the rif converts the tuple to a list and then divides it into a list of sublists - each sublist containing the 16 transformation values for a blob. Each of three entries, the transformation scaling factors, are assigned a new scaling value. Finally, using the itertools.chain() function the list of edited sublists are converted to a single tuple that is passed to the output. Listing 6 (rif_blobby.py)
|
© 2002- Malcolm Kesson. All rights reserved.