Before you write the code for your shader function, you can build its interface and create the necessary project files so
that you can successfully integrate your shader with Softimage. You can use the shader wizard to do this.
The shader wizard steps you through the templates that compose the SPDL file, which contains the information required to display
the shader's user interface. It also generates the project files you need to write your shader, ensuring that your implementation
structures match the parameter definitions in the SPDL file.
- Click to open the Plug-in Manager.
Note
In the Tools Development Environment layout, click the tab to switch to the Plug-in Manager view.
- Do one of the following:
- To create the property in the User location, click .
- To create the shader in a different location (such as a workgroup or an Add-on directory), expand the location in the Plug-in
Tree, right-click the folder and click .
The mental ray shader wizard appears.
- Under , type short and long names for the shader.
The first character in a shader name should be a letter. Subsequent characters can be letters, numbers, or underscore (_)
characters.
- Add parameters to the shader.
- If the shader supports more than one render engine, fill in the metashader information.
- Define the layout of the parameters on the property page.
- On the tab, click to generate the SPDL, C++, and .VCPROJ files for the shader.
All the generated files are put in the specified output folder (by default, in the Application\spdl folder).
- If the spdl file is not listed in the Plug-in Tree, click the tab and then click .
- Compile the shader. Put the compiled dll/dso in the Application\bin\{CPU} folder, where {CPU} is nt-x86, linux, or nt-x86-64.
- Generate a preset for the shaders. In the Plug-in Tree, right-click the SPDL file and choose .
Adding Parameters
The tab allows you to customize the Parameter section in the generated SPDL file.
- In the Shader Wizard, click the tab.
- Under , define a parameter:
- In the list, click the type of the parameter.
- In the box, type a name for the parameter.
- In the box, type the text that will appear on the property page.
- Set the other parameter attributes as required.
- Click .
Note
- To edit a parameter, click the shaded cell at the start of a row (the row should be highlighted a light green), and then click
. Edit the parameter definition and then click .
- To delete a parameter, click the shaded cell at the start of a row (the row should be highlighted a light green), and then
click .
MetaShader Information
The Metashader Information tab allows you to customize the MetaShader section in the generated SPDL file. For example, you can set options for mental ray, or specify a custom render engine.
To add a custom render engine
- Select the check box.
- In the box, type the name of the rendering engine.
- In the , type the name of the shader function.
- If the shader is implemented in a file, type the name of the file in the box.
- Shader Text is text that is inserted in the BeginText...EndText section of the SPDL file. For example, the implementation of the shader may be included in this section.
- Add any options required by the render engine.
To add an option
- Under:
- In the box, type the name of the option.
- In the box, tpye the vale oft he option.
- Click .
- To edit the name or value of an option after you add it, click a cell and type the new text.
- To delete an option, click the shaded cell at the start of a row (the row should be highlighted a light green), and then click
.
Defining the Layout
The tab allows you to define the layout of controls on the shader's property page.
To add controls to the property page
In the list, click a parameter, and then click .
By default, parameters are added to the layout in the order you add them. But if you select a parameter in the Layout list,
then the next time you add a parameter it is inserted above the selected parameter.
You can reorder the Layout list using the Up and Down buttons.
To add a row
- Click .
An empty row is added to the list. If a parameter is selected in the list, the row is added above the selected parameter.
- In the list, click one of the parameters you want to put in the row, and then click (or ) until the parameter is in the row.
Do the same for the other parameters you want to put in the row.
To add a group
- Under , in the box, type a name for the group.
- Click .
An empty group is added to the list. If a parameter is selected in the list, the group is added above the selected parameter.
- To move a parameter into the group, click the parameter and then click either (if the parameter is below the group in the list) or (if the parameter is above the group in the list).
Similarily, to move a parameter out of a group, click the parameter and then click or until the parameter moves out of the group.
To add a tab
- Under , in the box, type a name for the tab.
- Click .
The first time you add a tab, all parameters already in the list are put on that tab.
- To add another tab, type a name for the tab in the box, and then (before you click ) do one of the following:
- Add more parameters to the layout, and then, in the list, click one of the parameters you just added.
- Use the and buttons to move some parameters off the tab.
- Click a tab (the line)in the Layout list. This will result in an empty tab being added.
Generating a Preset
In the Plug-in Tree, expand the SPDLs folder, right-click the shader SPDL file, and choose .
If the Plug-in Tree does not show the shader SPDL file, click on the tab.
Editing a Shader SPDL File
The Logic section of the SPDL file lets you add behavior to your shader's property page. For example, if no texture is applied to a
selected object, you can make the texture parameters inaccessible to users. The shader wizard does not generate this type
of behavior. You'll have to add it to the SPDL file yourself.
- In the Plug-in Tree, right-click the SPDL file and choose .