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.

Creating and Editing Shaders

In addition to the included sample shaders, Shader Builder allows you to create new shaders of your own. When creating shaders, Shader Builder displays an editing window, called Designer, that can be used to build the desired effect, visually.

Shaders in Shader Builder are constructed through a series of building blocks. The collection of these interconnected blocks is called a network. Shader Builder supports all functions and operations defined within the RenderMan Shading Language specification. See the RenderMan Interface Specification (RISpec) for more details.

Creating New Shaders

To create a new shader follow these steps:

  1. Select the desired Shader Category in the Catalog.
  2. Press the New Shader… button to add a new shader. Alternatively, you can right-click the empty area of the Shader View and choose New Shader… from the context menu.
  3. You will then be prompted to enter a name for the shader name: INSERT IMAGE
  4. When creating a new light shader you will also be asked for the light type. These types directly correspond to the light types available in DAZ Studio and define basic functionality of the shader.

Designer is then displayed.

Editing Existing Shaders

To edit a existing shader, follow these steps:

  1. Select the desired shader in the Shader View area of the Catalog. Navigate to the desired category and depth as needed.
  2. Double-click the icon for the shader you would like to edit. Alternatively, you can right-click the icon of the shader you would like to edit and choose Edit Shader… from the context menu.

Note that a third options also exists, where a Designer tab appears next to the Catalog tab when a shader is selected in the Shader View. This alternate approach will display Designer within the tab without launching a new dialog.

Designer is then displayed.

The Designer

Elements of Designer

Viewport

The Designer viewport is quite similar to the standard DAZ Studio viewport(s). In fact, several of its settings are copied from the active viewport when Designer is launched. It allows quick rendering for reviewing shader changes. Note that the viewport is only available when Designer has been launched as a modal dialog, and not while displayed within the Shader Builder tab. To render a preview image of your shader, use the Render Preview button above the Working Area.

Block Repository

The Block Repository is located at the left side of the Block Network tab, in Designer. The Block Repository contains the following elements:

  • Functions – All pre-defined RSL functions. Shader Builder supports all documented RSL functions (and a few extras). You may also define/edit custom User Functions (see Creating new Functions and editing existing ones). To create a block in the Working Area, simply double click an entry.
  • Macros – The available pre-defined RSL Macros. Shader Builder supports a specific set of predefined macros. You may also define/edit custom User Macros (see Creating new Macros and editing existing ones). To create a block in the Working Area, simply double click an entry.
  • Noises – The available pre-defined Noise Functions/Macros as defined in the RSL specification. To create a block in the Working Area, simply double click an entry.
  • Operations – The available pre-defined operations. To create a block in the Working Area, simply double click an entry.
  • Output -
  • Variables – The available pre-defined global variables as defined by the RSL specification. Note that not all variables are present for a specific kind of shader. See RSL language specification for details on which variables are available. To create a block in the Working Area, simply double click an entry.

Toolbar Buttons

  • Compile Shader
  • Save Network
  • Render Preview
  • Create Thumbnail

Working Area / Canvas

Code Tabs

Log Tab

Building Shaders from Blocks

Each shader consists of a series of Blocks. When you create a new shader you will be launched into Designer and you will see something similar to the following (depending on the type of shader you create):

INSERT IMAGE

  • User Parameters Block – This block is present for each shader and represents the input values to your shaders. Depending on the type of the shader, a set of input parameters is pre-defined (primarily default DAZ Studio parameters), but you can also define your own parameters (see Advanced Shader Editing). This is where you define what and how to expose control of your shaders to the end user.
  • Output Block(s) – At least one Output block is present for each shader and represents the final values of your shaders, as used by the renderer. When defining a Surface shader, multiple Output blocks are allowed. Depending on the type of the shader, a set of input parameters is pre-defined. See RSL specifications for details.
  • Variable Block – These block(s) are present for each shader and represent the global variables available to your shader. Depending on the type of the shader, a set of input parameters is pre-defined. You can add more variables using the Block Repository or Context Menus.
  • Block Output – Defines an output value available for a particular block. Each output has an associated type which corresponds with the data types available for the RenderMan Shading Language. You can connect an output to an input of another block with the mouse (LINK TO SECTION). Note that for a successful connection to be made, the data types of both input and output must match (or be compatible in the case of the variable type). The data types are identified by a color value.
  • Block Input – Defines an input value available for a particular block. Each input has a associated type which corresponds with the data types available for the RenderMan Shading Language. The data type is identified by a color value. Inputs receive their value from outputs of other blocks (LINK TO SECTION) or they can have constant values applied (LINK TO SECTION).
  • Block Connections – A connection between two blocks is identified by a spline curve with an arrow at the input side.

You can freely move blocks around inside the Designer Working Area and the view will update accordingly (see Selecting Blocks and Block Operations). You can also freely zoom the display using the Context Menus.

Designer Context Menus

  • Inputs
    • Connected
      • Disconnect - Break the connection between the input that activated the context menu and the output it is connected to.
      • Create Macro from Input… - Generate a custom Macro block based on the connection to the input that activated the context menu. The Macro is generated as a result of tracing all paths back to their respective starting points (i.e. global variables, User Parameters, non-connected inputs on upstream blocks). A dialog will be displayed, prompting you for the name of the custom Macro. The generated Macro is placed in the Block Repository under the Macros > User item.
    • Not Connected
      • Constant Value… - Displays a dialog that allows you to specify the constant value for the input. The value of the constant should be compatible with the input type, or the shader will likely encounter compile errors.
      • Connect/Create User Parameter… - Create a connection between the input that activated the context menu and the User Parameters block. If the name of the input parameter is found to have a match in the variable name of an output of the User Parameters, a connection is made. If no match is found, the New User Parameter dialog is displayed (LINK TO EDITOR) allowing you define a new parameter to connect to.
  • Outputs
    • Connected
      • Disconnect - Break the connection between the output that activated the context menu and the output it is connected to.
  • Block Specific
    • User Parameters
      • Edit User Parameters… - Displays the User Parameters Editor dialog. (LINK TO EDITOR)
      • Add Default Parameters - Inserts the 'default' user parameters for a given shader type.
    • Macro
      • Edit Macro Instance… - Displays the Macro Block Editor dialog. (LINK TO EDITOR)
    • RenderTime Script
      • Edit RenderTime Script… - Displays the RenderTime Script Editor dialog. (LINK TO EDITOR)
    • Output (Root)
      • Active in Beauty Pass only - Indicates that this shader is only used in the Beauty/Final pass.
      • Active in Shadow Pass only - Indicates that this shader is only used in the Shadow pass.
      • Active in Beauty and Shadow Passes - Indicates that this shader is used in both the Beauty/Final and Shadow passes.
    • All Blocks
      • Annotate Block… - Displays a dialog allowing annotations/notes to be added to the block. The annotation for the main output block of the shader is also used for the tool tip in the shader Catalog.
      • Remove Block - Removes the block under the cursor.
  • Global
    • New Block - A sub-menu containing the following items
      • Functions - A sub-menu containing all pre-defined Function blocks
      • User Functions - A sub-menu containing all user defined Function blocks
      • Operations - A sub-menu containing all pre-defined Operation blocks
      • Noises - A sub-menu containing all pre-defined Noise blocks
      • Variables - A sub-menu containing all pre-defined global variable blocks
        • User Variable
      • Macros - A sub-menu containing all pre-defined Macro blocks
      • User Macros - A sub-menu containing all user defined Macro blocks
      • Output - A sub-menu containing all pre-defined Output blocks; available on Surface shaders only
        • Atmosphere
        • Interior
        • Exterior
        • Displacement/Bump
      • RenderTime Script
      • Macro from shader source (*.sl)… - Generate a custom Macro block based on complete RSL source. Inputs to the Macro are determined based on the arguments to the main shader function. A dialog will be displayed, prompting you for whether or not you would like to store the Macro in the Block Repository. If you choose yes, the generated Macro is placed in the Block Repository under the Macros > User item. A separate dialog will be displayed allowing you to choose the source file. The shader type of the source file and the current shader must be compatible.
    • With Blocks Selected
      • Copy Selected Block(s) - Copy the selected blocks. The User Parameters block, as well as the various Output blocks, cannot be copied.
      • Remove Selected Block(s) - Delete the selected blocks.
      • Align Blocks - A sub-menu containing the following items
        • Align Lefts - Align the left edge of the selected blocks. The first block selected stays where it is, all of the others align to it.
        • Align Tops - Align the top edge of the selected blocks. The first block selected stays where it is, all of the others align to it.
        • Align Rights - Align the right edge of the selected blocks. The first block selected stays where it is, all of the others align to it.
        • Align Bottoms - Align the bottom edge of the selected blocks. The first block selected stays where it is, all of the others align to it.
    • Without Blocks Selected
      • Paste Block(s) - Paste any copied blocks.
    • Zoom In - Zoom in by one increment.
    • Zoom Out - Zoom out by one increment.
    • Zoom Normal - Reset zoom to the initial state.
    • Setup Colors… - Displays the Designer Colors dialog. (LINK TO EDITOR)

Connecting and Disconnecting Blocks

To connect one block to another, follow these steps:

  1. Press the left mouse button on the output of the source block
  2. Move the mouse while keeping the left mouse button pressed; you will see a dashed wire line following your movements.
  3. Move the mouse to the input of the desired target block. The wire line turns to green to indicate that the connection is possible. If it turns red the two cannot be connected because the types are not compatible.
  4. Release the left mouse button to connect the two blocks.

Note that outputs can be connected to multiple inputs, thus reusing the output value in different computations, while inputs can only accept one connection.

To remove a connection of two blocks, follow these steps:

  1. Press the right mouse button on the input of the target block or on the output of the source block.
  2. A context menu will open that has an option to remove the connection. See Designer Context Menus for details.

Editing User Parameters

The User Parameters block is used to determine what the end user will see in the Surfaces tab (for Surface, Displacement, Area Light and local Volume shaders) or the Parameters tab (for Light, global Volume and Imager shaders). This block is essentially responsible for establishing the connections between a property in the DAZ Studio interface and the RSL shader; via arguments to the main shader function.

When editing the User Parameters block, you will see a dialog similar to the following:

INSERT IMAGE

The dialog has the following elements:

  • ListView - The list of output parameters for the block.
  • Move to Top - Move the selected parameter to the top of the list.
  • Move Up - Move the selected parameter up one position in the list.
  • Move Down - Move the selected parameter down one position in the list.
  • Move to Bottom - Move the selected parameter to the bottom of the list.
  • Update Attributes - Apply the [modified] values currently displayed in the various fields to the selected parameter.
  • New… - Displays a dialog populated with unique variations (where applicable) of the currently selected parameter, allowing you to create a new parameter.
  • Delete - Deletes the parameter currently selected in the ListView.
  • Parameter Attributes :
    • Name - The internal name of the current parameter. This value is the name used when saving information to Presets by an end user.
    • Class - The name of the DAZ Studio API class used as the property widget for the parameter.
    • Range - The range of values for the property. For a DzFloatProperty or a DzIntProperty this should consist of two values separated by two periods (i.e. 0..1). For a DzEnumProperty this should consist of the string values to be displayed, separated by semi-colons (i.e. One;Two;Three). For a DzFileProperty this should be the filter string (i.e. “FilterName (*.ext1 *.ext2 *.ext3)”).
    • Mappable - Whether or not the property will be displayed as being mappable to the end user within the Surfaces/Parameters tab. INSERT IMAGE The Choices option (below) must have a value or this option will automatically be reverted to the unchecked state when stored.
      • Choices - The name of the Shader Attribute > Variable for a given parameter to use as the map input to the shader. Only those parameters assigned a Class of DzImageProperty, which are also not already assigned to another parameter, will be available in the drop-down menu.
      • Must Map - Signifies that the property must be given a map by the end user (within the Surface/Parameters tab) before the associated slider widget will be displayed; like the Displacement/Bump properties found on the default surface shader.
    • Label - The label displayed on the block and to the end user within the Surfaces/Parameters tab, for the current parameter.
    • Group - The group that the property is displayed within to the end user.
    • Value - The default value for the property. For a DzFloatProperty or DzIntProperty this should be a numeric value appropriate for the type (i.e. 1 or 1.0). For a DzBoolProperty this should be the boolean value (i.e. true or false). For a DzColorProperty this should be a DAZ Script expression that evaluates to the appropriate value type (i.e. new Color( 255, 255, 255 )). For a DzEnumProperty this should be the index into the array of string values to display. For a DzStringProperty this should be the string value to display (i.e. \“foo\”). For a DzFileProperty this should be the enumerated value for the type of file dialog to display (i.e. DzFileProperty.FileOpen). For a DzImageProperty this should be the DzTexture object for the image to select (i.e. App.getImageMgr().getImage(\“C:/foo/bar.jpg\”)). This field can be left empty or contain the word “undefined” (without quotes) if no value should be set.
    • Hidden - Determines whether or not the current parameter is normally hidden from view for the end user.
    • Display as Percent - Determines if parameters declared as DzFloatProperty are displayed to the end user as a value or as a percentage.
  • Shader Attributes :
    • Type - The data type and type modifier of the current parameter.
    • Variable - The name of the variable for the current parameter.
    • Default - The default value of the current parameter. This value must be compatible with the chosen shader parameter type or it will cause compiling errors.
    • RenderTime Script - Indicates whether the value of the associated property is passed directly to the shader or is intended to be processed by a RenderTime script.
    • Deferred Declaration - Determines whether the argument to the shader should be declared automatically, or if the argument is declared based on the logic defined in the RenderTime Script.

Selecting Blocks and Block Operations

Blocks can be selected in the Designer Working Area (aka Canvas) by simply clicking on the titlebar of the desired block. Holding the Ctrl or Shift key on your keyboard while selecting will add to your selection. Designer also supports selection of multiple blocks at a time by clicking and dragging a selection rectangle (aka marquee) with the mouse. Selected blocks can be moved with the mouse by clicking and dragging on the titlebar for one of the selected blocks. Additional operations can be performed by accessing the context menus.

RenderTime Script Blocks

Output Blocks and Options

Compiling Shaders

To compile a shader, simply press the Compile Shader button while in Designer, or press the Compile Network button in the Catalog. Pressing the Compile Network button in the Catalog performs additional operations. (INSERT LINK TO CATALOG)

INSERT IMAGE