Slim Ribbox Scripting III
return to main index |
|
i n t r o d u c t i o n
Slim Ribbox Scripting I & Scripting II
provided introductory and intermediate examples of using TCL expressions in a slim ribbox.
This page provide several ribbox (TCL) scripts that cause a polygon mesh and a nurbs
curve to be replaced by a series of objects. In the first example, the MEL commands clientcmd
and pointPosition are used to querry the vertex data of a polygonal mesh. The
xyz coordinates of each vertex of the mesh are used to position (arbitary) objects across the
mesh. The second example uses pointOnCurve to replace a curve with a series of objects.
polymesh replacement Figure 1 shows a character model that was kindly made available to me by Kelly Eisert. Figure 2 shows the effect the ribbox, shown in ribbox listing 1, has had on the rendering of the model.
ribbox listing 1 |
![]() figure 1 - original model ![]() figure 2 - polygon mesh replaced by cubes |
|
Lines 2 and 3 obtain the name of the
transformation node of the model. For example, slim's pre-defined variable $OBJPATH
may contain the following text,
TransformBegin
Translate 0.139515 -2.34644 1.20277
ReadArchive "G:/archives/cube.rib"
TransformEnd
In this example, ReadArchive is referencing a pre-baked rib of a cube. However, any
geometry could be used and the placement of the geometry can, of course, be modified
by other transformation and/or attribute commands. For example, figure 3, shows the effect
of assigning opacity to each pre-baked rib according the vertex "number".
|
ribbox listing 2 - surface normals |
|
curve replacement
At first sight it would seem the task of writing a ribbox (TCL) script to
place objects along a curve would be easier than the previous problem of replacing
a polymesh with pre-baked objects. Generating equally spaced (xyz) locations with
the MEL command pointOnCurve is, indeed, straightforward. The tricky part
is figuring out how to place objects, say pre-baked ribs, at those locations in such
a way that they "follow" the curve when it changes shape or when it is moved.
ribbox listing 3 |
RIB listing 1
To ensure the xyz positions returned by the pointOnCurve are equally spaced the following MEL command must be applied to the curve. rebuildCurve -rt 0; This command also ensures a better "fit" (figure 5) of the replacement objects and the curve. Incidently, the curve to which the ribbox is attached must also be assigned mtor->Curve Rendering->Attach. See Maya Curves to RenderMan Curves
|
© 2002-6 Malcolm Kesson. All rights reserved.