• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Creating a Multipass Macro

Creating a Multipass Macro

Macros are user-created nodes that essentially “box up” a Shake script you've created so that no one can see the wiring (unless they really want to). It allows you to build your own node. As far as you're concerned, you might as well be looking at one of Shake's standard nodes, like an Over or a Mult. Think of a macro as a plug-in you can make without having to be a C++ programmer. The really great thing about macros is that they're very easy to create and very easy to reuse, and they conveniently put all your controls in one parameters tab.

Working with the MacroMaker

If something went tragically wrong with the last exercise, you can cheat by opening a previously prepared script. Select File > Open Script, go to the Appendix/scripts folder, and load the MacroTree.shk script. (Or simply continue with the script you saved in the previous section.)

In the Node View, select all the nodes except the FileIn nodes—that is, do not select Key_Diff, Key_Spec, Key_Refl, and Key_Shad.

When creating a macro, you want to include only those parts of your script that will always be part of the process. Since we're building a macro to be used in all kinds of occasions, not just with the four image files in our current scene, we leave these out of the macro.

With all the nodes selected and your mouse over the Node View, press Shift-M (or choose Macro > Make Macro from the right-click menu in the Node View). This brings up the MacroMaker.

The MacroMaker is an incredibly easy way to create macros in Shake without having to geek out and type lines of code into a text editor (though once you start messing with macros, you might find yourself doing just that—and liking it). The only catch is that it's a one-way street. Once you click the OK button, you can't reopen the MacroMaker and make some quick changes. Your options are to edit the created macro outside of Shake in a text editor or repeat the process from the start. As a result, be sure and follow the next few steps carefully.

In the list of nodes you see under UserMacro, open the parameters of any nodes that are closed by clicking on the + to the left of the node's name.

We're about to choose from these lists of parameters the ones we want the user of our macro to be able to access. These will appear in our macro node's parameters window when we click the right side of the node. There are only a few controls that need to be edited; the rest can be fixed at a certain value and hidden.

Once you're done selecting from a given node which of its parameters will be visible in the final macro, click on the – to the left of the node name to close its parameters. When all the parameter groups are closed, you'll know you've finished selecting parameters.

In the Macro Name field, type MultiLight, and in the Macro Toolbox field, type CG.

This sets the name of your macro to MultiLight and creates a new tab in the Tool tabs section called CG. If you had typed Layer instead, your macro would have ended up in the existing Layer tab.

Next to each parameter are six entry columns. Parameter name gives the name the user will see for that control in the parameters view. Default value is the value that the control will have when the macro is first added to a script. Status decides whether a parameter will show up in the final macro's parameters view; turning the “v” LED off will mean that the user will not be able to modify that control. The Minimum and Maximum fields decide the start and end range of the slider control associated with a parameter. A user can still numerically enter a number outside that range if she chooses. Granularity determines whether discreet numeric jumps will occur as the slider is moved.

In the IAdd1 section, rename the Foreground parameter DiffuseIn. Make sure the Status LED is illuminated. Make sure no other Status LEDs are illuminated in the IAdd1 section.

You've created an input knot on the macro called DiffuseIn. Don't worry about changing the default value; Shake will automatically treat this as a lonely knot just waiting to be connected to the greater scheme of things.

Close the IAdd1 section by clicking on the minus (–) to the left of its label.

There are no parameters in IAdd2, IMult1, or Invert1 that we want a user to access, so making sure there are no LEDs illuminated in the Status section of any of these nodes, close these sections as well.

In the MasterLevel parameters section, change the red parameter name field to masterRed, green to masterGreen, and blue to masterBlue. If you have previously adjusted the values in MasterLevel, you'll need to set the default values back to 1 in each of the three. Turn the LEDs on in the status section for all three of these parameters. Make sure no other LEDs are illuminated in the MasterLevel section, then close it up.

In ReflLevel, change the In parameter name to ReflectIn and the value parameter name to reflection. Make sure the default value for reflection is set to 1. Set both visibility LEDs to on. Close the section.

In ShadLevel, change the In parameter name to ShadowIn and the value parameter name to shadow. Make sure the default value for shadow is set to 1. Set both visibility LEDs to on. Close the section.

In SpecLevel, change the In parameter name to SpecularIn and the value parameter name to specular. Make sure the default value for specular is set to 1. Set both visibility LEDs to on. Close the section.

Now that all the sections are closed, you know that you have checked and set parameters for all nodes inside your macro.

To confirm that your settings are correct, check each macro section against the following screenshot:

Make sure the Macro's output (towards the top left of the MacroMaker window) is set to MasterLevel, then click OK at the base of the window.

Look in the Tool tab section and you'll find a new tab called CG. In there, you'll find a single node selection button called MultiLight. Click on the button and your brand new macro is added to the Node View.

If you've made changes to your script other than creating the macro, save your work.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint