Custom Shader Examples

These examples show how to create self-installing custom shader definitions using various implementation languages.


Color Sampler
These examples were ported from the SPDL-based Color Sampler Lightmap shader. They demonstrate how to create a custom lightmap output parameter, and how to create a property page widget that allows the user to specify a texture space id. This example is available in C++ and JScript.

Environment Blur
These examples were ported from the SPDL-based Environment Blur shader. It demonstrates how to create a property page widget that allows the user to select a shader. This example is available in C# and JScript.

Fast Volume Effects
These examples were ported from the SPDL-based Fast Volume Effects shader. It demonstrates how to define structure and array parameters and how to modify the property page layout. This example is available in VBScript and JScript.

Model Map
These examples were ported from the SPDL-based Model Map shader. It demonstrates how to create property page widgets that allow the user to specify a texture space id and a CAV. They also demonstrate how to define a drop-down list of values. This example is available in Python and JScript.

Example Files

Location
Files
JSShaderExample.js
PYSShaderExample.py
VBShaderExample.vbs
CSShaderExample.cs
CSShaderExample.csproj
CPPShaderExample.cpp
CPPShaderExample.vcproj
GNUmakefile

Running the Examples

To run the Color Sampler example

To run the Environment Blur example

To run the Fast Volume Effects example

To run the Model Map example

Building the C++ Color Sampler Example

Follow the instructions below to build the examples.

To build the Color Sampler example on Windows

  1. Open a Softimage command prompt, and type devenv to start Visual Studio .NET.

    Starting Visual Studio .NET from a Softimage command prompt ensures that environment variables such as XSISDK_ROOT are set (otherwise you'll get build and link errors).

    Tip To load the Simple Command project from the command line, type:

    devenv cppsrc_CPPColorSampler\CPPShaderExample.vcproj
  2. In Visual Studio .NET, open the project file .vcproj.
  3. Select a configuration (Win32/Win64 Release or Debug) and build the DLL.

To build the Color Sampler example on Linux

  1. In a shell (tcsh) window, type:

    source $XSI_HOME/.xsi_<xsi_version>
  2. Change directories to

    cppsrc_CPPColorSampler
  3. To remove all intermediate files before building the example, run this command:

    gmake clean
  4. To compile the example, run this command:

    gmake

Building the C# Environment Blur Example

Follow these instructions to build the C# plug-in.

Note: You can either use Visual Studio .NET 2005 or Visual C# 2005 Express Edition to build the example. Visual C# Express can be downloaded freely at http://msdn.microsoft.com/vstudio/express/visualcsharp/.

To build the example on Windows

  1. Open a Softimage command prompt, and type devenv to start Visual Studio .NET.

    Starting Visual Studio .NET or Visual C# Express from a Softimage command prompt ensures that environment variables such as XSI_USERHOME are set (otherwise you'll get build and link errors).

    Tip To load the CSShaderExample project from the command line, type:

    devenv cssrc_CSEnvBlur\CSShaderExample.csproj
  2. In Visual Studio .NET, open the project file .csproj.
  3. Select a configuration (Release or Debug) and build the DLL.

Keywords

This example uses the following keywords:

C++, JScript, Python, VBScript, C++ example, JScript example, Python example, VBScript example, C# example, RegisterShader, Define, DefineInfo, ShaderDef, Context, GetSource