Example Code Overview

Softimage 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.

 

If you build the shaders from these example source files and try to install them in Softimage, they will replace the factory shaders.

If you want to install the new shaders but still keep the factory versions, you must do the following in order to prevent collisions in the spdl/phenomena/phenolib:

1. Rename the .DLL or .SO

2. Change all references in the SPDL and generate new GUIDs

3. Generate a new preset

 

Cg Shaders

Other Shader Examples

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

 

 

GLSL Shaders

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

Shader

Function

Comments

GLSLProgram

Builds a complete program using the high-level OpenGL Shading Language (GLSL). Vertex and fragment shaders can be defined as one “entity” within a single GLSL Program node.

 

GLSLUniform

Defines a single uniform parameter to be used by the GLSLProgram shader. When the GLSL Program shader is called, it retrieves the list of uniforms defined and pass them to the vertex or fragment shader.

The uniform qualifier is used to declare global variables whose values are the same across the entire primitive being processed.

 

Other Shader Examples

These are new realtime shaders for version 3.0. The third column gives their location relative to (under) the %XSI_HOME%\XSISDK\examples\realtimeshader folder:

Shader

Function

Location

CompatibilityShaderRTS2

The compatibility shader is an example that shows how to build a RTS 2.0 shader in 7.0. This is for people who have internal shaders that they not wish to port over to RTS 3.0.

CompatibilityShader

OGLParticle

The OGLParticle is a shader that can be used to render particle clouds in real time using various methods. You can use this shader to render point clouds as primitives (such as boxes, spheres or debris) You can also use this shader with a OGLTexture node to apply a texture to a particles and render them as billboards. The source code is made available to illustrate how realtime shaders now interact with particle clouds.

Particles\OGL



Autodesk Softimage v7.5