Shader Compounds

In the render tree, you can hook up shaders together and set their values to create an effect. Once you have things set up as you like, you can then create a compound that contains all of these shaders, just as you can with nodes in the ICE tree.

Shader compounds allow you to create an effect and save it in one container, then use it in different scenes or share it with other users. You can expose only the parameters of each shader that you want others to see and adjust.

You can create a shader compound containing any type of shader. The compound can contain many shaders connected together, or just one shader, if you like. For example, you could put a single, large shader into a compound and then expose only a handful of necessary parameters that often need to be set.

There are some shader compounds available in the render tree that you can use and examine to get started, such as in the Particle group for more information. Then follow the steps below to create your own shader compound.

The next section shows you briefly how to create a shader compound, which is very similar to the process for creating ICE compounds. For more details and information about ICE compounds, see Building ICE Compounds [ICE Fundamentals].


A simple shader compound opened up for editing.

Creating a Shader Compound

To create a shader compound

1. In the render tree, select all the shader nodes you want to save in the compound.

To keep the compound generic, you should leave out the Material node so that you can apply this compound to any object’s Material node.


2. From the render tree toolbar, choose Compounds > Create Shader Compound.

The selected shader nodes disappear from view, and you’re left with a generic compound named ShaderCompound, which contains all the shaders that just disappeared.

3. Click the little e in the upper-left of your new compound to edit it. This opens up the compound so that you can start exposing ports for it.


You now want to expose the different ports from the shaders to make only those parameters editable.

The gray bar on the left shows where you will expose shader ports for your compound. Before you start exposing ports, you need to decide on what you want other people to be able to change and connect to in the compound.


You can click the arrow at the top of the exposed ports bar to expand or collapse the list of exposed input parameters. When the list is collapsed, you can display the name of a port by hovering the mouse pointer over its connection.


4. To include a port in the exposed ports bar, click the black circle (Expose input) at the top of this bar and drag it to the node’s port that you want to expose. The port is then included on the bar. Keep doing this for every port you want to expose.


5. You can rename this exposed port by right-clicking on it and choosing Properties to open the Exposed Port Properties editor, then entering new names:

- The Name is the one that is displayed in the gray area on the left in the edit compound layout and is used in scripting.

- The Display Name is the one that is displayed in the compound node in the render tree and in the compound’s property editor. If this is blank, then the Name is used as the Display Name.

If you double-click on an exposed port in the gray bar or right-click and choose Rename, this sets only the scripting Name, not the Display Name.


You can define how a port appears on the node in the render tree and in the node’s property editor. Right-click on an exposed port to open the Exposed Port Properties editor: under Property Page Layout, you can specify whether it is Visible and assign it to a Tab and a Group. Under Render Tree Layout, you can specify whether it is Visible and assign it to a Group.

6. Create the output port by dragging an output port from the shader on the furthest right (the shader into which all other shaders are plugged) to the black dot on the gray exposed output bar on the right.

You can click the arrow at the top of the exposed output bar to expand or collapse the list of exposed output ports. When the list is collapsed, you can display the name of a port by hovering the mouse pointer over its connection.

You can rename the exposed output ports in the same way as you do for the exposed input ports.


7. In the bar at the top of the editing compound layout, double-click where ShaderCompound is written and give your compound a class name (in this example, it’s Bonfire).

- The class name is used in the compound’s properties, in the preset manager, for scripting, and in the Classname column of the shader version manager (after exporting).

When you close the compound, you won’t see this name in the render tree until you export the compound, then re-import it.

8. Do the same for the Category, which is where it will show up in the groups in the preset manager, giving it a name such as Particle. If you don’t give a Category name, the compound appears in the Shader Compounds category.


If you like, you can add comments to your compound to document how everything inside it works. See Adding Comments to Render Trees for information.

9. Click the little x box in the upper-left corner to close the compound and return to the regular render tree.

10. You can then rename the shader compound node to be the same as the name you gave it inside the compound (see below about names for why this is). Double-click the compound node and enter a new name.

You may need to expand the node’s connections to see the ports that you exposed.

11. Choose Compounds > Export Shader Compound from the render tree toolbar to export your compound so that others can use it. See Exporting Compounds [ICE Fundamentals] for more information.

Differences Between Shader Compounds and ICE Compounds

Shader compounds are very similar to ICE compounds, so most information about ICE compounds also applies to shader compounds — see Building ICE Compounds [ICE Fundamentals].

Here are the main differences:

• Shader compounds have two names: the class name (see step 7 in Creating a Shader Compound) and the instance name. Changing one does not change the other.

The instance name appears as a label on the node in the render tree, in the node’s property editor, and in the Instance column of the shader version manager. This is used when there are multiple versions of the shader compound available in the scene.

• Shader compounds don’t have associated tasks and subtasks. They just have categories — see step 8 in Creating a Shader Compound. If no category is specified, they appear in the Shader Compounds category.

• Shader compound nodes do not display an asterisk when you modify them.

• Shader compounds do not require a Pass Through node to share an exposed input port.

• When editing a shader compound, you can set either the Name or Display Name — see step 5 in Creating a Shader Compound.

• You can define how a port appears on the node in the render tree and in the node’s property editor — see step 5 in Creating a Shader Compound.

• Because shaders do not allow an arbitrary number of connections, you cannot define multi-instance ports.

• You cannot define a picking string for exposed ports or a construction mode for shader compounds. The ApplyICEOp command does not apply to shader compounds.

• Shader compounds have a file extension of .xsirtcompound.

• You cannot export shader compounds as private, and they do not store the display state of connections (because you cannot display the values of connections in the render tree).

• You can make shader compounds uneditable—see Editing Shader Compound Properties.

• See Versioning Shader Compounds for more information specific to shader compound versions.

Editing Shader Compound Properties

Shader compounds have properties that allow you to give them distinguishing information.

To set compound properties

Do one of the following:

• Right-click on a shader compound node in the render tree and choose Compound Properties.


• Select a compound and choose Compounds > Compound Properties from the render tree menu bar.

If you are editing a compound and no internal compound node is selected, choosing this command opens the properties of the compound that you’re editing.



The class name of the shader compound — see step 7 in Creating a Shader Compound.


The group in the preset manager where the shader compound is located — see step 8 in Creating a Shader Compound..


Name of the author for identification purposes. This field is optional.


Information that can help you and other users identify the purpose of the shader compound. This field is optional.

Press Ctrl+Enter to start a new line in the Description box.


Version of the shader compound — see Versioning Shader Compounds for information.

Version Tag is optional information that you can add to describe this version of the shader compound.


Color of the shader compound node in the render tree.


Makes the shader compound editable or not:

• Select this option if you want your shader compound to be edited by other users.

• Deselect this option to prevent other users from editing the shader compound, especially by accident! When this option is off, the little “e” on a shader compound node is hidden and the Edit Compound command is grayed out.


Opens up the Shader Compound PPG Logic property editor in which you can choose the scripting language and logic for the shader compound.

Versioning Shader Compounds

As you create shader compounds, you’ll find that you will probably want to create several versions of it, either for fixing bugs or for adding enhancements. You can have control over the versions of shader compounds in a manner that is similar to that of ICE compounds.

This section describes the only issues that are specific to shader compounds, but you can find basic information about versioning compounds in Versioning Compounds [ICE Fundamentals].

These are the main differences between versioning ICE and shader compounds:

• Shader compound nodes in the render tree do not display an asterisk when you modify them. As a result, if you make a change to a shader compound, you should change the compound version number directly after making a change.

• There is no built-in versioning system to automatically increment version numbers and re-export modified compounds as ICE compounds have.

• When you import a shader compound that nests other compounds, it uses the exact major.minor version specified rather than the highest minor version of the specified major version, as ICE compounds do. If you want to use the latest minor version, you need to add it to your shader compound manually, then re-export it.

Modifying the Version of a Shader Compound

For complete control over a compound’s version numbers, you need to modify the version numbers in the compound’s properties and re-export it, as described below.

Shader compounds that already exist in a scene are not updated automatically even if new versions are available. However, you can update them using The Shader Version Manager.

To modify the version of a shader compound

1. Open the compound’s properties as described in Editing Shader Compound Properties.

2. Increase the Version number as appropriate:

- Update the major version for changes in functionality, such as additional nodes and exposed ports.

- Update the minor version number for bug fixes.

3. If desired, enter a Version Tag. This is a character string that you can use to describe this version.

4. Export the compound as described in Exporting Compounds [ICE Fundamentals].

Autodesk Softimage 2011 Subscription Advantage Pack