...
Excerpt | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Shader MetadataThe metadata about the shader itself is provided between the shader name and its parameter list. For instance:
The supported shader annotations are:
Specifies the string to use for the shader name in the user interface, when possible.
Katana-specific
The shader will be considered a surface shader or a displacement shader, respectively. Tagging a shader with one of these values will have 3Delight for Katana create a Network Shader node along with the surface shader or displacement shader, and connect it appropriately. The tag will also allow the shader to be listed as surface material or displacement material in a Material node. texture/3d The shader will be considered a 3D texture.
The shader will not be listed in the shading node layered menu (shown when pressing the
Maya-specific The IDs from You may use any ID between
Maya-specific The classification string will be prepended with the standard 3Delight shader node classification string so that the nodes are correctly identified as supported shading nodes when the scene is output to the renderer. The classification string can be set to any value, but using one of the following will list the shader in the specified 3Delight category in the HyperShade:
The shading node will be classified as a surface shader and will be listed under 3Delight → Surface in the HyperShade. Upon creation, Maya will create a new shading group and connect this surface shader's
The shading node will be classified as a 2D Texture node and will be listed under 3Delight → 2D Textures in the HypersShade. Upon creation, Maya will automatically create and connect a place2DTexture node to the shader's uvCoord parameter. See UV Coordinate parameter below for details on how to declare such parameter.
The shading node will be classified as a 3D Texture node and will be listed under 3Delight → 3D Textures in the HypersShade. Upon creation, Maya will automatically create and connect a place3DTexture node to the shader's placementMatrix attribute. The OSL shader must provide a matrix input parameter that is either named
The shading node will be classified as a Utility node and will be listed under 3Delight → Utilities.
Maya-specific Parameter metadataParameter metadata is provided between a parameter's default value and the comma that ends its declaration. For instance:
Attribute specification MetadataThe following meta-data provides details that are used when generating the attribute of the shading node that corresponds to a given shader parameter.The supported parameter annotations are:
Specifies the name of the attribute that corresponds to this parameter. There are many reasons to use these attribute - parameter mapping: because the software or OSL imposes restrictions (e.g. an attribute named "color" in Maya, which is a reserved word in OSL), because the shader has different parameter naming conventions than what is expected in the software, or because the required attribute in the software is part of a complex attribute structure that does not have an OSL counterpart.
When none of the above metadata are provided, the parameter name is used directly to define the attribute name. The
Specifies the name of a shader to be connected to this shader parameter when no connection exists. The only supported value is
Maya-specific int skip_init Setting this metadatato 1 will will prevent the attribute value from being passed as a shader parameter value when rendering. Only incoming connections to this attribute will be defined when rendering. This allows passing implicit values to shader parameters, such as:
Specifies the type of the attribute related to this shader parameter. By default, the attribute type is derived from the parameter type and the widget type.
Map the shader parameter to a boolean attribute. Valid for integer shader parameters.
Maya-specific
Maya-specific User Interface MetadataThe following meta-data provides details about the user interface presentation of the shader parameter.
Specifies a string that will be shown in a help box or tool tip. This is currently only supported in Katana.
Specifies the label of the widget that controls the attribute. In Maya, this only has an effect in the Attribute Editor. If no label is specified but
Katana-specific
Define the minimum and maximum values allowed for the attribute. In Katana, this defines the slider range, as an attribute value cannot be boundedof a numeric parameter, respectively. When both are defined, the attribute gadget will be made of a numeric field and a slider. In Maya, this configures the attribute with the specified hard minimum and / or maximum value. In Katana, there is no way to enforce minimum or maximum values on attributes. Nevertheless, having a slider shown helps providing information about the parameter's useful range of values. Providing only
Maya-specific
This metadata provides extra options for specific widget types. See
Specifies the name of a group under which the widget of the attribute will be placed. Nested groupscollapsable section that is used to group together related attributes. Nested pages can be defined by formatting thepage value string as "parent group.child group". setting this metadata to a string containing the path to the given page. For instance:
Specifies the range of of the slider widget that controls the attribute. This is ignored in Katana.In Katana, providing only one of
This meta-data should be set to 1 for parameters that specify a texture file name
Specifies the type of the attribute related to this shader parameter. By default, the attribute type is derived from the parameter type and the widget type.
Valid for integer shader parameters.
Valid for integer shader parameters. The enumeration list should be set using the options metadata.
Maya-specific Valid for string shader parameters. A message attribute will be created and the connected node's name will be passed as this shader parameter's value.
Specifies the type of widget to controlgadget that will show the attribute's value(s). By default, a gadget appropriate for the attribute type is generated. In Maya, matrix attributes are not shown in the Attribute Editor. The following values are supported when it is required to override the default gadget:
An option menu with a list of items that have an associated numeric value. The list of item labels and values are defined using the . The enumerationenumeration list and values for a type set to enum or a widget set to mapper is expected to be defined using the | . For instance:Set options to a string containing one or more
navigation Maya-specific
Katana-specific
No widget will be created for this attribute. Note that the attribute will still be defined.
An option menu. The selected menu item label is set as the attribute value. This widget works for string shader parameters. The menu items are defined by the Code Block | The string shader parameter will be presented as an option menu with predefined menu items. The menu items are specified by the floatRamp The ramp widgets require more than one shader parameters and are explained in a dedicated section. Getting the texture coordinates Because retrieving the UV coordinates is a costly process, it is best to centralize this operation in a single shader and share the results with all shaders. For a shader to benefit of this, it may declare a parameter similar to this:
This uses the following metadata intended to address this specific problem:
This combination of metadata instruct that when no incoming connection exists on the node attribute, one should be established between the uvCoord shader that 3Delight outputs by default and this parameter. The uvCoord shader is the centralized place to fetch the UV coordinates. Ramp widgetsThe ramp widgets in Maya and Katana both require 3 different attributes. They also have diverging expectations and features. Maya-style float ramp widgetThe triplet of shader parameters required to present a Maya-style float ramp can be declared as follows:
Maya-style color ramp widget
|
...