Realtime shaders appear in the XSI interface under these circumstances:
• The object is using a material that has realtime shaders connected to it and the viewport is set to realtime shaders > OpenGL or realtime shader > DirectX.
• The object is using an override material as part of an graphic sequencer display pass.
The following sections describe the execution flow for a realtime shader in XSI:
• Realtime Shader Initialization
When the .dll is initialized, the first function to be called is GetVersion. This function should return the following constant:
XSI_RTSHADER_VERSION
Realtime Shader Initialization
When realtime shaders can be executed (i.e. the viewport is set to one of the realtime shaders mode), and a realtime shader is created, the <shader>_Init function is called. This is where you can create instance user data and where you should initialize it.
Every time the object that uses the material to which the shader is attached needs to be redrawn, the <shader>_GetRequirements function is called. This function is called three times with the following flags:
• RTS_REQUIRE_ZSORT
• RTS_REQUIRE_OBJECTHANDLE
• RTS_REQUIRE_MATERIALHANDLE
• RTS_REQUIRE_LIGHTHANDLE
Then the <shader>_Execute function is called. This is where your main code should be.
When a realtime shader is destroyed, the <shader>_Term function is called.
SOFTIMAGE|XSI v6.01