User Tools

Site Tools


This page exists within the Old ArtZone Wiki section of this site. Read the information presented on the linked page to better understand the significance of this fact.

Advanced Shader Editing

The Block Repository in Designer is extensible. The ability to define new custom functions and/or macros, as well as edit any existing blocks in the User category, is provided. To do this, you should be especially familiar with the RenderMan Shading Language (RSL). A good starting point is the RenderMan Interface Specification (RISpec) available on the Pixar website.

Adding/Editing Block Parameters

Function

When editing a custom Function block, you will see a dialog similar to the following:

INSERT IMAGE

The dialog has the following elements:

  • ListView - The list of input and/or output parameters for the block.
  • Parameter Attributes :
    • Type - The data type and type modifier of the current parameter.
    • Variable - The name of the variable for the current parameter.
    • Name - The internal name of the current parameter.
    • Label - The label displayed on the block for the current parameter.
    • Default - The default value of the current parameter.
    • Required - Whether or not the current parameter is required to be connected or be given a constant value.
  • New - Creates a new parameter using the values currently provided in the Parameter Attributes groupbox.
  • Delete - Deletes the parameter currently selected in the ListView.
  • Required Function Blocks - A semi-colon (“;”) delimited list containing the names of other Function blocks in the Block Repository that are required by the Function block being edited.
  • Function Result - The data type of the Function “Result” output parameter.
  • Code - The RSL code that is evaluated when the function is executed.
    • Note that the Code field contains RSL source code with two additions:
      • %<Number>% - This kind of identifier refers to a parameter variable by index. The <Number> placeholder defines the index of the parameter and is substituted with the variable name of that parameter when the shader is compiled. For example, %1% specifies the first parameter in the list.
      • §<Number>§ - This kind of identifier declares/defines a local variable. The <Number> placeholder defines the index of the local variable and is substituted with the name of that variable when compiling the shader. For example, §1§ specifies the first local variable. Local variables must be declared before usage (e.g “float §1§ = 0:”).

Macro

When editing a custom Macro block, you will see a dialog similar to the following:

INSERT IMAGE

The dialog has the following elements:

  • ListView - The list of input and/or output parameters for the block.
  • Parameter Attributes :
    • Type - The data type and type modifier of the current parameter.
    • Variable - The name of the variable for the current parameter.
    • Name - The internal name of the current parameter.
    • Label - The label displayed on the block for the current parameter.
    • Default - The default value of the current parameter.
    • Required - Whether or not the current parameter is required to be connected or be given a constant value.
  • New - Creates a new parameter using the values currently provided in the Parameter Attributes groupbox.
  • Delete - Deletes the parameter currently selected in the ListView.
  • Required Function Blocks - A semi-colon (“;”) delimited list containing the names of other Function blocks in the Block Repository that are required by the Function block being edited.
  • Macro Result Name - The label displayed on the block for the “Result” parameter.
  • Function Result - The data type of the Function “Result” output parameter.
  • Global Code - The RSL code (typically functions) in the global scope of the shader, executed outside the scope of the main shader function.
  • Initialization Code - The RSL code of the Macro that is executed within the scope of the main shader function, but before the Evaluation Code is evaluated.
  • Evaluation Code - The RSL code that is evaluated within the scope of the main shader function.
  • Note that the Global/Evaluation/Initialization Code fields contains RSL source code with two additions:
    • %<Number>% - This kind of identifier refers to a parameter variable by index. The <Number> placeholder defines the index of the parameter and is substituted with the variable name of that parameter when the shader is compiled. For example, %1% specifies the first parameter in the list.
    • §<Number>§ - This kind of identifier declares/defines a local variable. The <Number> placeholder defines the index of the local variable and is substituted with the name of that variable when compiling the shader. For example, §1§ specifies the first local variable. Local variables must be declared before usage (e.g “float §1§ = 0:”).

Creating new Functions and editing existing ones

To define a new Function use the “New Function…” menu item at the top of the context menu for the Functions >User item in the Block Repository, within Designer.

To edit an existing Function, use the “Edit Function…” menu item in the context menu for the Functions >User >%BlockName% item in the Block Repository, within Designer.

Creating new Macros and editing existing ones

To define a new Macro use the “New Macro…” menu item at the top of the context menu for the Macros >User item in the Block Repository, within Designer.

To edit an existing Macro, use the “Edit Macro…” menu item in the context menu for the Macros >User >%BlockName% item in the Block Repository, within Designer.