Cutter
|
IntroductionThe Cutter text editor is can assist artists create, edit and test slim scripts. There are two types of slim scripts - those that define the UI for a precompiled shader (.slo) imported into HyperShade and those that implement a shading node for use in the Slim editor. The former are called appearance slim scripts; the latter are called template slim scripts - both use the .slim file extension. How Cutter handles appearance slim scripts is the subject of the tutorial Cutter: Slim Appearance Scripts. |
|
Template .slim ScriptsA template script implements one or more nodes for use with Pixar's Slim shading editor. Similar to an appearance, a template slim file contains GUI information but in addition it also contains code that is used by Slim to generate a "chunk" of RSL that becomes part of a shader that is compiled "on-the-fly" by Slim.
Artists can take advantage of Cutter's Slim-related functionality to create custom nodes either in a manual or semi-automatic fashion. An explanation and example of the former can be found at Cutter: Manual Slim Template Scripting This tutorial demonstrates how Cutter can be used to generate a template script (custom node) directly from a RSL function. Converting a RSL Function to a NodeTo demonstrate Cutter's ability to generate a custom node (template) from a trivial RSL function called "Flame" implemented in a .h (header file) named flame.h. |
Listing 1 (flame.h)
|
An example of a simple shader that uses the function is given next. Note that flame.h and flame_test.sl must be in same directory. |
Listing 2 (flame_test.sl)
Figure 1 shows the "flame" effect applied to a polygon. Surface "flame_test" "Kfb" 1.0 "freq" 9.0 "blur" 0.020 "top" [1.0 0.0 0.0] "lower" [1.0 1.0 0.0] Polygon "P" [-0.5 0 -0.5 -0.5 0 0.5 0.5 0 0.5 0.5 0 -0.5] "st" [0 0 0 1 1 1 1 0]
When used in a shading network the Flame node must have its "noisiness" parameter
connected to one of Slim's noise related nodes, such as, |
|
InputsUnlike the node derived from the surface shader (listing 1) in which the noise function was "hard wired", the new node can receive "noise" values from a variety of different nodes such as brownian, wavelet, turbulance etc. |
|
|
|
Outputs
Since the new node is of "type" More Examples of Using ui-hintsTo avoid the necessity of making manual connections and adjustments to parameters the following ui-hints can be added as comments to the function. Listing 4
A new template generated from the edited function presents the following interface in Slim.
More information about ui-hints can be found at Cutter: Ui-Hints for Slim. |
Step 1 - Creating a Custom Node from a Surface ShaderCopy and paste the following code, taken from the tutorial RSL: Flames and Opacity, into Cutter. Make sure the shader code compiles using the keyboard shortcut alt+e or control+e or apple+e. Cutter is not able to export a valid template slim script unless the original RSL source code can be compiled. Listing 1 - flame.sl
Select the shader code and use to the right mouse button to raise the popup menu as shown below.
An untitled slim script will open on Cutter's desktop. The script does not require saving before it is previewed. A copy of the slim script can be found here. Step 2 - Previewing the Node in SlimCutter can help preview the template in Slim via a socket (port). The following steps outline the process.
Cutter executes the template writing two files,
To open a Maya port on Windows 7
This is similar to Vista. However, with
Vista "localhost" is preceded with a colon ie. |
|
|
Unlike the original shader from which the template was exported, the parameters of the node in Slim can receive inputs from other nodes - figure 4. However, because Flame.slim implements a shadingmodel node it cannot pass values to other nodes. The notes accompanying step 5 show how a node that both receives values from, as well as sends values to other nodes can be created by Cutter from a RSL function rather than a shader.
Templates can also be loaded "manually" using Slim's console window using the
|
Step 3 - Publishing a Template
Once a template has been pre-viewed and considered useful it should be saved
in a directory that will be sourced by Slim when it starts up. Detailed notes on this
subject can be found in the tutorial
"RfM: Customizing".
In essence, getting Slim to source custom templates is relatively easy. Pixar's
RenderMan for Maya requires an environment variable, |
Step 4 - Controlling Parameter Widgets
Values for the Listing 2
Specifying the type of UI widget for a parameter
is done by embedding a ui-hint in the comment associated with a parameter.
A ui-hint is text that begins and ends with square brackets. For example, this ui-hint,
|
© 2002- Malcolm Kesson. All rights reserved.