Category Archives: Shaders
ERROR File not found in SPDL registry during render
A customer recently reported that random machines on the farm were reporting this error. They have custom shaders installed in a workgroup, and the workgroup lives on a network drive that is accessible to all machines on the farm.
So, what is this SPDL registry thing?
It’s a file named spdl.xsiindex, and it’s a cached index of all the shader spdl files. Softimage creates/updates this SPDL registry at startup (so you can delete it to force the recreation of a new file).
You can find the file in %XSI_USERHOME%\Application. Actually, the file is named “spdl.MACHINE.xsiindex”. We had to add the machine name to the file name to prevent issues with concurrent access. However, I would think that if you ran multiple instances of xsibatch on the one machine, you might still have problems.
There’s also a MTL2UA0150CWY.xsishaderdefcache file to deal with the new-fangled, non-SPDL shaders.
Overriding SPDL defaults

In the old days, if you didn’t like some default shader parameter setting, you had to edit a SPDL file and generate a new preset. As of 2011, you can use the ObjectModel (OM) to dynamically update the shader definition.
For example, if you run this Python snippet in the script editor, then the next time you create an Environment shader, it will have some different defaults:
- Environment Mode will default to Cylinder
- Transformation will have a connection icon

- Background Intensity will default to 0.5
from siutils import si # Application from siutils import log # LogMessage from siutils import disp # win32com.client.Dispatch from siutils import C # win32com.client.constants # Get ShaderDef for the Environment shader sProgID = "Softimage.sib_environment.1.0" oDef = si.GetShaderDef( "Softimage.sib_environment.1.0" ) # Get ShaderParamDef for the Tranformation parameter oTransform = oDef.InputParamDefs.GetParamDefByName( "transform" ) # Make it texturable so it has a connection icon oTransform.Texturable = True # Make Cylinder the default Environment mode oParam = oDef.InputParamDefs.GetParamDefByName( "mode" ) oParam.DefaultValue = 1 # Change the default background intensity to 0.5 oParam = oDef.InputParamDefs.GetParamDefByName( "background_intensity" ) oParam.DefaultValue = 0.5
So, that’s how you update a shader definition. Now, all you have to do is stick that code into a siOnCreateShaderDef event plugin, and every time you create an Environment shader, it will have the defaults you want
import win32com.client
from win32com.client import constants
null = None
false = 0
true = 1
def XSILoadPlugin( in_reg ):
in_reg.Author = "blairs"
in_reg.Name = "ShaderDef Plug-in"
in_reg.Major = 1
in_reg.Minor = 0
in_reg.RegisterEvent("CreateShaderDef",constants.siOnCreateShaderDef)
return true
def XSIUnloadPlugin( in_reg ):
strPluginName = in_reg.Name
return true
# Callback for the CreateShaderDef event.
def CreateShaderDef_OnEvent( in_ctxt ):
oDef = in_ctxt.GetAttribute("ShaderDef")
sProgID = str(in_ctxt.GetAttribute("ProgID"))
if "Softimage.sib_environment.1.0" in sProgID:
oDef.InputParamDefs.GetParamDefByName( "transform" ).Texturable = True
# Return value is ignored as this event can not be aborted.
return true
Tip: Use the SDK Explorer (CTRL+SHIFT+4) to get the ProgID of a shader.

Animating the Environment shader Transformation parameter
We’ve had a couple of questions about this recently, so here goes…
In the 2011 release, parameters like the Environment shader’s Transformation parameter were changed to expose the raw transformation matrix instead of StaticKineState. This allows ICE attributes to plug directly in the shader input matrix ports and have texturable matrix ports.
A transformation matrix is a combination of the scaling, rotation, and translation, and when you start animating those values, you’re going to see some “weird” numbers
For example, if I animate the Z rotation from 0 to 45 degrees, I’ll see this in the Animation Editor. Note that in the viewport I’m using ICE to show the transformation matrix for a cone that has the same Z rotation from 0 to 45 degrees: see how it matches up with the fcurves for the Environment transformation.
To make things more artist-friendly, you have to make the Transformation parameter texturable so you can plug in a Create_Transform node in the render tree.
To make the Transformation parameter texturable, install this addon.
Specifying the help file location in SPDL
In 2011 and later, you can’t use OriginPath to find the location of the inspected shader/texture. Instead, use ShaderDef.DefinitionPath.
ShaderDef.DefinitionPath will return something like:
' INFO : C:\Users\blairs\Autodesk\Softimage_2012_SP1\Addons\baVolume\Application\spdl\BA_fluid.spdl
So you could do something like this in your SPDL file to specify the location of your help:
Sub OnInit() setAlpha_OnChanged() Set ppi =PPG.Inspected(0) s = ppi.ShaderDef.DefinitionPath sHelp = Left( s, InStr( 1, s, "spdl" ) - 1 ) + "../help/index.htm" PPG.PPGLayout.SetAttribute siUIHelpFile, sHelp End sub
Combining mental mill CgFX shaders with Softimage and ICE FX trees
This video demonstrates how to export a CgFX shader from mental mill to softimage and combine it with an Ice Effect tree.
It shows techniques to augment your exported CgFX code by hand editing the exported CgFX code and passing data that was generated by an ICE FX tree in softimage to the shader. This enables you to create a completely new type of effects.
Here’s the corresponding mentallmill.blogspot post.
Installing compounds and addons in a workgroup
FindObjects() and shaders in Softimage 2011
Update 10 Dec 2010: See this post about finding shaders using the ProgID.
In Softimage 2011, all [factory] shaders have the same Class ID ({6495C5C1-FD18-474E-9703-
AEA66631F7A7}), so FindObjects returns a collection that contains shaders in the scene.
Note that the returned collection will include the soft_light shader, as well as several hidden Lambert shaders that are used under-the-covers by Softimage.
var x = FindObjects(null, "{6495C5C1-FD18-474E-9703-AEA66631F7A7}" );
LogMessage( x.Count );
oEnum = new Enumerator( x ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var oSelItem = oEnum.item() ;
try {
LogMessage( oSelItem.fullname );
i++;
}
catch(e)
{
LogMessage(e.message);
LogMessage( "\t" + ClassName(oSelItem) + ":" + oSelItem.name);
LogMessage( "\t" + oSelItem.GetShaderContainer() );
}
}
You could filter the returned collection for a specific type of shader. For example:
// Get all shaders
var x = FindObjects(null, "{6495C5C1-FD18-474E-9703-AEA66631F7A7}" );
LogMessage( x.Count );
var oShaderCollection = new ActiveXObject( "XSI.Collection" );
// Build up a collection of all Blinn shaders
oEnum = new Enumerator( x ) ;
for (;!oEnum.atEnd();oEnum.moveNext() )
{
var oShader = oEnum.item() ;
try {
//LogMessage( oShader.ProgID );
if ( oShader.ProgID == "Softimage.material-blinn.1.0" )
{
oShaderCollection.Add( oShader );
}
}
catch(e)
{
LogMessage(e.message);
}
}
T2S_MentalRay addon
The T2S_MentalRay addon includes copies of Softimage DLLs, such as sibase.dll, and that causes problems in Softimage 2011. I’ve had two cases of shader/workgroup problems that were resolved by removing this addon.
Update: As noted in the comments, the problem is older versions of SPDL files that contain GUIDs used by the Softimage factory shaders. Addon shaders are loaded first, so these SPDLs override the factory defaults and cause problems.
Installing shaders with just the .mi and .dll files
|
Hirazi Blue beat me to it, but I did have this post in draft form for awhile. Really, I did. Given a .mi file and a dll, Softimage 2011 can automatically load and register a shader. For example, in the screenshot you can see I have the JS_fisheye and ctrl_studio .mi files in a workgroup. In your workgroup, create the following folders:
And then drop the .mi and .dll files into the corresponding folders. I used the Plug-in Manager to create my workgroup, and on 32-bit it created a Application\bin\nt-x86 folder. But Softimage didn’t load the DLL from that folder. According to Process Monitor, Softimage looked everywhere but Application\bin\nt-x86:
Note that I didn’t get the JS_fisheye shader to work in 64-bit Softimage 2011. Even though Softimage loaded the DLL, I still got the error “// ERROR : PHEN 0.4 error 051011: shader “JS_fisheye” not found”. Dependency Walker didn’t show any problems with JS_fisheye.dll. |



