Shader Definition Wizard

 
 
 

The main purpose of the Shader Definition Wizard is to generate the code required for defining and implementing hardware shaders (C++ realtime shaders) into Softimage. The Shader Definition Wizard provides the basic code structure for integrating a shader in no time.

The basic definition code for mental ray shaders can also be generated with the Shader Definition Wizard. However, the wizard doesn't generate the mental ray callback code — the mental ray Shader Wizard is more appropriate for that task.

Displaying the Shader Definition Wizard

  1. Choose File Plug-in Manager.

  2. Click New.

  3. Choose Shaders Shader Definition to open the wizard.

Plug-in

Name

Name of the plug-in file to generate. The plug-in will contain the necessary code for creating the shader definition. The name is also used for setting the plug-in object name and for specifying the default hardware shader .vcproj file.

Author

Name of the author creating the shader plug-in.

Language

The language used for creating the shader definition plug-in. The following languages are supported: Python, C++, JScript, VBScript.

Note that the language doesn't affect the shader implementation code which is always generated in C++.

Output Directory

The directory name where all files are generated. The default is the current user directory.

Definition

This is where the shader definition and renderer information is specified. For convenience, preset buttons can be used to quickly setup the wizard for generating hardware and Mental ray shader code.

Hardware Shader Preset

Click Hardware Shader Preset to set up the wizard with mandatory information required for generating the renderer registration and hardware shader callbacks. The mandatory setting for hardware shaders are:

  • Renderer name: OpenGl or DirectX

  • Renderer code path: plug-in name

  • Shader Definition Family: siShaderFamilyRTShader

  • Shader output port type: siHWShaderPortType

  • Shader Definition Option Name: siHWShaderVersionAttribute

  • siHWShaderVersionAttribute Option Value: siHWShaderV1

ImportantIf the above information is missing or not properly set, the generated hardware shader may not work properly.
NoteThe plug-in name as code path is optional and can be replaced with any name.

Mental Ray Shader Preset

Click Mental Ray Shader Preset to set up the wizard with mandatory information required for generating the renderer registration for mental ray shaders. These settings are the following:

  • Renderer name: Mental Ray

  • Renderer code path: {LIBS}/xsibase.{EXT}

Notexsibase is not mandatory and can be replaced with any other mental ray shaders.

Shader

Name

The shader name which uniquely identifies the shader in Softimage.

Major Version

The shader major version number.

Minor Version

The shader minor version number.

Family

The shader family type.

Category

The shader category name. This category is used to identify the where the shader is listed in the preset manager.

Display Name

The UI name used to identify the shader in the render tree.

Attribute Name

This name is used for identifying a user-defined attribute.

Attribute Value

The attribute value for a user-defined shader attribute.

Renderer

Name

The name of the renderer associated to the shader. Available renderers are: OpenGL, DirectX, and Mental Ray. Hardware shaders are typically set with OpenGL or DirectX.

Symbol

User-defined name used to map a shader with its renderer.

Code Path

The name of the shader library for this renderer. For hardware shaders, the name is used for the shader library file name to generate. For mental ray shaders, the name refers to an existing mental ray library.

Options

Name

User-defined option name for the renderer.

Value

Value set for a given renderer option.

Add

Add a new renderer option entry in the renderer option grid.

Remove Selected

Remove a selected entry from the renderer option grid.

Parameters

This tab is used for setting the input and output parameters for the new shader definition.

Input Parameters

Name

The name of the parameter.

Type

The parameter's data type.

Description

The description of the parameter which is used as a tool tip in the render tree.

Animatable

Set the parameter as animatable.

Inspectable

Set the parameter as inspectable.

Texturable

Set the parameter as texturable.

Default Value

The parameter's default value. The default value is only enabled for the following parameter types:

  • siShaderDataTypeBoolean

  • siShaderDataTypeInteger

  • siShaderDataTypeScalar

Hard Limit Values

Min and max value range for the parameter.

Soft Limit Values

Min and max UI slider values for the parameter.

Attribute Name

User-defined attribute for this parameter. The new attribute can also be chosen from a built-in list of attribute names.

Attribute Value

The value associated to a given parameter attribute.

Add

Adds a new parameter entry to the parameter grid with the above values.

Remove Selected

Remove the selected parameter from the parameter grid.

Output Parameters

Name

The name of the parameter.

Type

The parameter's data type.

Description

The description of the parameter which is used as a tool tip.

Main

Identify the parameter as the main output parameter.

Attribute Value

The value associated to a given parameter attribute.

Add

Add a new parameter entry to the parameter grid with the above values.

Remove Selected

Remove the selected parameter from the parameter grid.

Generate Code

Click Generate Code to generate the code based on the wizard settings. The new shader entry will show up in the render tree automatically. Hardware shaders must be compiled first in order to be usable from the render tree.

The wizard generates the plug-in registration code for the shader definition and renderer. The following files are generated:

  • shader definition plugin-in file

  • plug-in .vcproj file (C++ only)

  • hardware shader C++ file (for hardware shaders only)

  • hardware shader .vcproj (or GNUMakefile for Linux)

For hardware shaders, if you choose a scripting language for the shader definition plug-in code, the wizard will generate a separate .vcproj file for the hardware shader C++ file. However, if you choose C++ as the plug-in language, the hardware shader C++ file will be added to the plug-in .vcproj file and no separate .vcproj will be generated for the hardware shader.

The .vcproj output setting is set to the standard plug-in location:

<user folder>\Application\Plugins\bin\<platform folder>

For example:

C:\Users\fred\Autodesk\Softimage_2011\Application\Plugins\bin\nt-x86-64

The list of callbacks generated for the shader definition is:

  • <Plugin Name>_<Shader Name>_<Major version>_<Minor version>_Define

  • <Plugin Name>_<Shader Name>_<Major version>_<Minor version>_DefineInfo

The list of callbacks generated for the hardware shaders is:

  • <Symbol Name>_<Major version>_<Minor version>_<Renderer name>_Init

  • <Symbol Name>_<Major version>_<Minor version>_<Renderer name>_Execute

  • <Symbol Name>_<Major version>_<Minor version>_<Renderer name>_Term

  • <Symbol Name>_<Major version>_<Minor version>_<Renderer name>_GetAttributeList

Some examples:

  • HWS_Shadow_1_0_Define

  • Shadow_1_0_opengl_Init

  • Shadow_1_0_directx_Execute

NoteThere is no shader callback code generated for Mental ray shaders.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License