Generate the SPDL file

To define the user interface of a realtime shader, create a SPDL file. You can create it by hand or you can use the shader wizard that comes with the Softimage SDK (right-click on the SPDLs folder in the Softimage Plugins Tree and choose New > Shader from the context menu).

| On the Shader Information tab, there are three settings specific to Realtime shaders: • Set the Main Group to Realtime. A new checkbox and a new text box appear. • When you enable the Generate Drawing Code option, the wizard writes a call to the IRTSExecutionState::DrawGeometry function inside the Execute callback. • You can optionally specify a prefix to be used in the callback functions the wizard writes in the C++ Callback Prefix box. By default, this box is populated with the name of the shader followed by _cb (for example myshader_cb).

Example of a SPDL file generated by the wizard:

    # SPDL Generated by Softimage Shader Wizard
    SPDL
    Version = "2.0.0.0";
    Reference = "{BDFA8D12-898F-4EA3-8697-35998888131D}";
    PropertySet "Halo_pset"
    {
       Parameter "out" output
       {
           GUID = "{2CF07A36-819E-4F74-8274-26E63E8026D5}";
           Type = rtrendercontext;
       }
       Parameter "Halo" input
       {
           Title = "Halo";
           GUID = "{72A82046-0D2B-4F06-BE8F-C3B8C09349BC}";
           Type = string;
           Value = "Halo";
           Inspectable = off;
       }
       Parameter "Halo" input
       {
           GUID = "{4EEC3CBD-3B8A-4B86-9D0C-EC23E1777FB1}";
           Type = string;
           Value = "Halo";
           Inspectable = off;
       }
       Parameter "previous" input
       {
           GUID = "{8523985F-A961-4B01-9179-AA32224CE3E5}";
           Type = rtrendercontext;
           Texturable = on;
       }
       Parameter "inner_ring" input
       {
           GUID = "{E15724EF-4A13-403C-BDEB-FEE3930DB03E}";
           Type = scalar;
           Value = 1.0;
       }
       Parameter "outer_ring" input
       {
           GUID = "{E5FA4D50-C71A-4CFB-BB5C-C252850C1598}";
           Type = scalar;
           Value = 1.1;
       }
       Parameter "color" input
       {
           GUID = "{2BC32197-E76A-4B56-BFEA-761E9C552DD3}";
           Type = color;
           Value = 1.0 0.0 0.0 0.5;
       }
       Parameter "tex" input
       {
           GUID = "{4C03FB2C-67C0-481B-8A07-C7E5172E165E}";
           Type = texture;
       }
    }

    MetaShader "Halo_meta"
    {
       Name = "Halo Shader";
       Type = rtrendercontext;
       Renderer "realtime"
       {
           Name = "Halo";
           FileName = "Halo";
       }
    }

    Defaults
    {
       inner_ring
       {
           Name = "inner_ring";
       }
       outer_ring
       {
           Name = "outer_ring";
       }
       color
       {
           Name = "color";
           UIType = "rgba";
       }
       tex
       {
           Name = "tex";
       }
    }

    Layout "Default"
    {
       Row
       {
           inner_ring;
           outer_ring;
       }
       Row
       {
           tex;
       }
       Row
       {
           color;
       }
    }

    Plugin = Shader
    {
       FileName = "Halo";
    }

Example of the source file generated by the shader wizard

    // C++ Source Code Generated by Softimage Shader Wizard

    ////////////////////////////////////////////////////////////////
    // Includes

    #ifdef _WIN32
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #endif
    #define SHADERS_EXPORTS
    #include <XSI_rtshaders.h>
    #include "Halo.h"

    // Default list of vertex attributes.
    // Add or remove attributes to suit your shader
    XSI_RTS_Attribute g_HaloAttribs[] =
    {
           XSI_RTS_ATTRIBUTE_POSITION, ePOSITION,
           XSI_RTS_ATTRIBUTE_NORMAL, eNORMAL,
           XSI_RTS_ATTRIBUTE_COLOR , eCOLOR0,
           XSI_RTS_ATTRIBUTE_COLOR , eCOLOR1,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD0,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD1,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD2,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD3,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD4,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD5,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD6,
           XSI_RTS_ATTRIBUTE_TEXUVW , eTEXCOORD7,
           NULL
    };

    ////////////////////////////////////////////////////////////////
    // Implementation

    extern "C" RTSHADER_API ULONG RTS_GetVersion()
    {
       return XSI_RTSHADER_VERSION;
           }

    // Main
    extern "C" RTSHADER_API bool
    Halo_Execute
    (
       IRTSExecutionState *in_pExecState, //! The execute state
       Halo_t                          *in_pParams, // The property page parameters
       XSI_RTS_Primitive *in_pPrimitive, // The geometry information
       void          *in_pAttributes,          // The attribute data
       XSI_RTS_Attribute_Size *in_pAttributesSize, // the sizes
       void          **io_pInstanceData        // The shader instance data
       )
    {
       // TODO: Drawing or state manipulation code goes here.

       in_pExecState->DrawGeometry ( OpenGL,
                                in_pPrimitive,
                                g_HaloAttribs,
                                in_pAttributes,
                                in_pAttributesSize );

       return( true );

    }

       extern "C" RTSHADER_API bool
    Halo_Init
    (
       IRTSExecutionState *in_pExecState, //! The execute state
       Halo_t                          *in_pParams, // The property page parameters
       void                     **io_pShaderInstanceData //! The shader instance data
       )
    {
       // TODO: Initialisation code goes here.

       return( true );
    }

    extern "C" RTSHADER_API bool
    Halo_Term
    (
       IRTSExecutionState *in_pExecState, //! The execute state
       Halo_t                          *in_pParams, // The property page parameters
       void                     **io_pShaderInstanceData //! The shader instance data
       )
    {
       // TODO: Termination code goes here.

       return( true );
    }

    extern "C" RTSHADER_API XSI_RTS_Attribute*
    Halo_GetAttributeList
    (
       IRTSExecutionState *in_pExecState, //! The execute state
       Halo_t                          *in_pParams, // The property page parameters
       void                     **io_pShaderInstanceData //! The shader instance data
       )
    {

       return( g_HaloAttribs );
    }

    extern "C" RTSHADER_API bool
    Halo_GetRequirements
    (
       IRTSExecutionState *in_pExecState, //! The execute state
       Halo_t                          *in_pParams, // The property page parameters
       XSI_RTS_Primitive *in_pGeom,         //! The geometry information
       void                     **io_pShaderInstanceData, //! The shader instance data
       ULONG             in_lFlag,             //! The flag to check
       ULONG             *out_pValue           //! The returned value
    )
    {

       (*out_pValue) = 0;
       return false;
    }

Autodesk Softimage v7.5