Example Code Overview

SOFTIMAGE|XSI ships with the source code for all the factory realtime shaders. You can use them as reference implementations or as a starting point for your own shaders.

OpenGL 1.3 Shaders

DirectX Shaders

Cg Shaders

OpenGL 1.3 Shaders

These are all the OpenGL 1.3 realtime shaders. They can be found under: %XSI_HOME%\ XSISDK\examples\realtimeshader\OpenGL1.3

Shader

Function

Comments

OGL13CubicTexture

This node sets 6 images as an OpenGL cubic texture. You can select which texture target these images will be bound to.

Good example if using images and shader instance data

OGL13Draw

This node draws the geometry to OpenGL. It also controls depth tests, culling and blending.

Good example of drawing objects on the screen

OGL13Shade

This node sets the OpenGL material. You can set a simple material ambient, diffuse and specular color as well as specular decay.

Good example of using color widgets

OGL13Texture

This node sets an image as an OpenGL texture. You can select which texture target this image will be bound to.

Good example of using images and shader instance data

OGL13TexCoord

This node let's you specify texture wrapping/clamping/mirroring, texture coordinate transformations and automatic texture coordinate generation.

 

DirectX Shaders

These are all the DirectX realtime shaders. They can be found under: %XSI_HOME%\ XSISDK\examples\realtimeshader\directx

Shader

Function

Comments

DXDraw

This is the node that sends the geometry to DirectX. It also controls depth tests and blending.

Good example of drawing objects on the screen

DXCubicTexture

This node sets 6 images as a cubic DirectX texture target.

Good example if using images and shader instance data

DXFx2

This node allows you to load and display DirectX effects, stored in .fx files, in 3D views using the DirectX9 display mode.

 

DXHLSLProgram

This node compiles and executes a DirectX HLSL program

Good example of shader instance data and shader custom PSet

DXHLSLColor

This node sets a color as a DirectX HLSL program uniform parameter

Good example of using color widgets

DXHLSLMatrix

This node sets a matrix as a DirectX HLSL program uniform parameter

 

DXHLSLVector

This node sets a vector as a DirectX HLSL program uniform parameter

 

DXPixelShader

This node compiles and executes a DirectX pixel shader

Good example of shader instance data

DXPSColorConst

This node sets a RGBA color as a pixel shader constant

Good example of using color widgets

DXShade

This node sets the DirectX default vertex lighting shader. You can set a simple material ambient, diffuse and specular color as well as specular decay.

Good example of using color widgets

DXTexCoord

This node controls wrapping and texture matrices on a specific texture target

 

DXTexture

This node sets an image in one of the DirectX texture targets.

Good example of using images and shader instance data

DXTextureFile

This node allows you to import a texture image stored in the *.dds file format and use it, as would any other texture image, in a realtime-shader render tree.

 

DXVertexShader

This node compiles and executes a DirectX vertex shader

Good example of shader instance data

DXVSColor

This node sets a RGBA color as a vertex shader constant

Good example of using color widgets

DXVSVector

This node sets a 4D vector as a vertex shader constant

 

DXVSMatrix

This node sets a 4x4 matrix as 4 vertex shader constants

 

DXVSLightTracker

This node tracks various light attributes and maps them to vertex shader constants

 

Cg Shaders

These are all the Cg realtime shaders. They can be found under: %XSI_HOME%\ XSISDK\examples\realtimeshader\Cg

Shader

Function

Comments

CgColor

This node sets a color as a Cg program uniform parameter

Good example of using color widgets

CgFX

This node provides support for nVIDIA’s CgFX file format, Microsoft’s FX file format, and COLLADA’s FX file format with the Cg profile.

 

CgLightTracker

This node tracks lights parameters values such as position, direction, diffuse color and interest, and sets them in uniform parameters.

 

CgMatrix

This node sets a matrix as a Cg program uniform parameter

 

CgProgram

This node builds and compiles a Cg program. The Cg program node currently supports the following profiles:

• ARB vertex shader

• ARB fragment shader

• NV30 vertex shader

• NV30 fragment shader

• NV20 vertex shader

• NV20 fragment shader

Make sure your hardware properly supports the right profiles.

Good example of shader instance data and shader custom PSet

CgVector

This node sets a vector as a Cg program uniform parameter