Creating Realtime (Hardware) Shader Plug-ins

 
 
 

Writing Realtime Shader (sometimes called Hardware Shader) plug-ins in Softimage is like writing regular shader definition and shader language parser plug-ins with a few extra callbacks to implement.

Tip

For more information about Realtime Shaders in Softimage from a user's perspective, see the user guide.

For information about backwards compatibility with Softimage Realtime Shaders and your plug-ins, see Compatibility Information.

Execution Flow

The following table describes the execution flow for a realtime shader in Softimage:

Phase

Description

DLL Initialization

When the .dll/.so is initialized, the first function to be called is RTS_GetVersion. This function should return 4.

Realtime Shader Initialization

When realtime shaders can be executed (that is, when the viewport is set to one of the realtime shader display modes), and a realtime shader is created, the Init function is called. This is where you can create and initialize instance user data.

Attribute Definition

You can define which attributes should be rendered by declaring CHardwareAttributeArrays for the GetAttributeList callback function to return. Softimage takes this list of references to CHardwareAttribute objects and passes it to the Execute callback function when it is time to draw. At that time you can set certain conditions under which each CHardwareAttribute will be used to define how to render the geometry.

Realtime Shader Execution

Every time the object that uses the material to which the shader is attached needs to be redrawn, the Execute function is called. The Execute callback function is where you can perform several tasks, such as:

  • Accessing scene data

  • Rendering geometry

  • Raising errors

  • Getting legacy information

  • etc.

Realtime Shader Termination

When a realtime shader is destroyed, the Term function is called.