In Softimage, integrating shaders involves registering a set of parameters required by the shader code and hooking in the renderer (whether that is mental ray or a third-party renderer). In the past this was done by creating SPDL files, which required generating GUIDs for each property set and parameter, registering each SPDL file in Softimage, and then generating a preset from that SPDL.
As of v9.0 (2011), Softimage now supports a lightweight mechanism for registering the parameters and associating the renderer(s): the shader definition. Shader definitions tell Softimage how to build a shader node in the render tree by defining a set of parameters and associating one or more renderers with options and attributes. These definitions now take the place of the old presets, allowing you to integrate SPDL-less, or dynamic, custom shaders.
When users build a render tree in the UI, they drag presets from the preset manager onto the render tree workspace. When a shader definition is created, it tells Softimage what ShaderDef.DisplayName or ShaderDef::GetDisplayName or ShaderDef::PutDisplayName in the preset manager and where (ShaderDef.Category or ShaderDef::GetCategory or ShaderDef::PutCategory) to display it. Then, when the shader is actually instantiated, Softimage builds the shader node with its input and output parameters, including data type, restrictions on connections, default values, etc. This makes Softimage shaders extremely dynamic, since they are built in a just-in-time manner only when instantiated.
There are several ways to create shader definitions:
Write a self-installing plug-in shader definition.
Shader definitions built this way are considered to be plug-in based definitions (ShaderDef.PluginBased or ShaderDef::GetPluginBased returns true). This is the most typical method of creating shader definitions.
Provide a text-based file that a registered shader parser can use to build shader definition from.
A shader parser allows you to create shader definitions in batch by defining a file format and writing a parser to read those files and use them to create shader definitions (see Creating Shader Language Parser Definitions). Softimage provides two realtime shader parsers: one for CGFX files and one for HLSL files. Shader definitions built by shader parsers are considered to be parser-based (ShaderDef.ParserBased or ShaderDef::GetParserBased returns true).
Create a shader definition on the fly (not persisted).
You can do this by using the XSIFactory.CreateShaderDef or Factory::CreateShaderDef method. The shader definition won't be persisted. Shader definitions built on-the-fly are not really parser-based nor plug-in-based, but ShaderDef.ParserBased or ShaderDef::GetParserBased still returns true. In addition, the ShaderDef.DefinitionPath or ShaderDef::GetDefinitionPath is empty.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License