Creating a Shader Compound

 
 
 

This 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.

  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 - see Editing the Exposed Port Properties below for more information.

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

    NoteIn the Exposed Port Properties editor, you can also determine how exposed ports are displayed in the shader compound's property editor and on its node in the render tree.

  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.

    Note

    You can add comments to your compound to document how everything inside Documenting Trees Groups and Comments for more 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. 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 for more information.

Editing the Shader Compound's Exposed Port Properties

You can define the name of the exposed port, as well as how a port appears on the compound's node in the render tree and in the compound's property editor.

A

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.

B

The Display Name is the one that is displayed in the compound's node in the render tree and in the compound's property editor. If this is blank, then the Name is used for 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.

C

Property Page Layout options determine how the exposed port appears in the shader compound's property editor.

  • Specify whether it is Visible as a parameter in the property editor.

  • If the exposed port is a certain type (such as scalar, integer, or Boolean), you can set Minimum and Maximum values allowed for it in the property editor.

  • Assign the exposed port to a Tab in the property page. If a tab using the name you enter doesn't already exist, it's created.

  • Assign the exposed port to a Group of parameters in the property page. If a group using the name you enter doesn't already exist, it's created.

D

Render Tree Layout options determine how the exposed port appears in the shader compound's node in the render tree.

  • Specify whether it is Visible as a port in the node.

  • Assign the exposed port to a Group of ports in the node. If a group using the name you enter doesn't already exist, it's created.

E

Property Page Combo Control options let you create a drop-down combo list for this port in the shader compound's property editor.

Enter a name for the option to be displayed in the list in the Combo string field, then enter its value in the Combo value field and click the Add combo button to add it to the list.

Select a combo string/value set and click the Remove combo button to remove it from the list.